Re: Contest #2 Spazbot Question
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 22, 2004
- 602 views
> posted by: cklester <cklester at yahoo.com> > Is the following a valid bot program? Um.... No, not really. Nothing wrong with the structure of it... but get_orders() is to get orders for EVERY unit you control, not just a single one. I made a couple of little changes: (oh, and metrics[IDENTITY] is an int, you passed it to a sequence param)
include eubots.ew --Comments: -- This is a simple moving bot. It moves randomly. Good luck catching it. -- without warning --Initialise pos to be the size of the number of units it has left. pos = {} for x=1 to metrics[WIDTH] do -- HEIGHT for y=1 to metrics[HEIGHT] do -- WIDTH if arena[x][y] = metrics[IDENTITY] then pos = append(pos, {x,y}) end if end for end for return pos end function --get_orders function function get_orders(sequence arena, sequence metrics) sequence units units = find_all_units(arena, metrics) for a = 1 to length(units) do units[a] = {units[a], MOVE, rand(8) } --transform the unit into an order. end for return units end function eubot_init(routine_id("start"), routine_id("get_orders"), routine_id("cleanup") )
-- MrTrick