Re: Contest 2 Update:

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

Patrick Barnes wrote:

> There is a new constant in constants.ew called offset, who's elements
> correspond to the directions.
> So it's easy: 
> }}}
<eucode>
> for d = 1 to length(offset) do
>       temp = units[h][POS] + offset[d]

Remember to check the bounds before the next statement! :)

>       temp = arena[temp[1]][temp[2]]
>       if temp > 0 and units[temp][ID] != metrics[IDENTITY] then
>             orders = append(orders, {h, ATTACK, d} ) --note, still
> uses the number
>       end if
> end for

Maybe you could make it a function?

    temp = arena( x, y )

and have the bounds checking done by the engine/eubots code.

Or not.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu