[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Lists in Swarm
From: |
Matthew Mitchell |
Subject: |
Lists in Swarm |
Date: |
Sun, 21 Jan 1996 15:22:08 +1100 (EST) |
Hi, I am a student a Monash working with Bodan Durnota.
I am implementing some simulations in Swarm that were originally
implemented in Star-logo and have experienced a problem when using lists.
Using both the Heatbug and Mousetrap examples as a base, I want to add
new objects to the simulation as it runs. The objects occupy a location
in the 2D grid and are referenced using a list. However, I tried a
number of different ways to add to the grid and list as the simulation was
running only to continually get segmentation errors.
In the end I was using the following ActionGroup:
simActions = [ActionGroup create: aZone];
[simActions createActionTo: aGroup message:M(addOne)];
[simActions createActionTo: aGroup message:M(moveAll)];
The object aGroup simply adds an object the list (which it contains) when
sent the message addOne. On receiving the message moveAll, aGroup will
send a message to each object in the list making it move. Although I
could not get this to work using lists, it does work when I implement it
using an array I developed based on the Grid2D class in Mousetrap.
Is this due to insufficient knowledge of Swarm classes or should it be OK?
By the way, I am using swarm-951209, so I do not know whether the new
version is the same.
Regards
Matt
- Lists in Swarm,
Matthew Mitchell <=