simulator (Re: [Icfp04-discuss] three liberal arts)
Zsban Ambrus
ambrus at math.bme.hu
Wed Jun 9 12:00:11 EDT 2004
On Wed, Jun 09, 2004 at 01:40:14AM +0200, Laurent Desnogues wrote:
> Jed Davis wrote:
>
> Some gain could come by encoding the map as a one-
> dimensional array so that direction selection is
> just loading an offset instead of switching and
> computing x and y. Since the border of the world
> is rocky, you can't get wrong using offsets.
>
I would be really interesetd about how the combat rules could be done fast.
As implemented in the pseudocode I belive it might be too slow. It might
help much as I think it is executed a lot of times.
Two things that might help are 1. change the coordinate system so that the
adjacent_cell function could be as simple as adding one of the vectors
[1,0], [1,1], [0,1], [-1,0], [-1,-1], [0,-1]; or 2. calculating the number
of neighbours short-circuitting, that is, if you see two cells which does
not have red ants, than it's impossible that there are 5 red ants in the 6
cells. I didn't do any of these optimizations.
(My simulator was very slow, I think it might have been the slowest out of
all, as I wrote it in ruby. Also, I was stupid and used a slow machine.
See "mailto:icfp04-discuss at lists.seas.upenn.edu")
More information about the Icfp04-discuss
mailing list