[erlang-questions] write the ant simulation in Erlang?

Robert Virding rvirding@REDACTED
Fri Oct 10 02:57:07 CEST 2008

2008/10/10 Richard O'Keefe <ok@REDACTED>

> On 10 Oct 2008, at 10:47 am, Robert Virding wrote:
>> A first approximation would be to have one process per ant and one for the
>> world. The only problem would be handling atomic
>> look-at-the-immediate-world-around-me-and-make-a-move.
> Thinking idly about this last night, I wondered whether
> the look at the world bit *should* be atomic.  Real ants
> don't lock the real world, and while an ant is looking at
> one square, something _could_ move into a square it can't
> see.

This was to get around the problem of checking if a cell was free before
moving into and then finding the cell has been taken. The immediate world is
one cell left, center, right, so it is very immediate. The "spec" stated
only one ant per cell.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081010/e8970b50/attachment.htm>

More information about the erlang-questions mailing list