Re: Contest #2 Spazbot Question

new topic     » goto parent     » topic index » view thread      » older message » newer message

> 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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu