An example of a cell program is given below:
state center
{
color 0 0 0
emits (alive, 1) diffuses (A, 10)
transitions
(alive < 1) from any direction -> (center, body) in same direction;
-> (center);
}
state body
{
color 0.6 1 0.7
emits (alive, 1)
transitions
(alive < 1) from any direction & (A > 1) -> (body, body) in same direction;
-> (body);
}
Save this as sphere.cpa
Now write the SIM file for running this program. Specify the system, cell, parser models respectively as the ones provided
and write instructions for creating the initial center
cell
system sysmodels.simplebiology.SimpleBiology
cell cellmodels.simplecell.SimpleCell
parser parsers.CPA.CPAParser
0: new center 0 0 0
5: Output output\sphere_e1_01.out
10: Output output\sphere_e1_02.out
15: Output output\sphere_e1_03.out
30: Output output\sphere_e1_04.out
31: kill sphere 0 -100.1 0 99
31: kill sphere 0 100.1 0 99
32: Output output\sphere_e1_05.out
34: Output output\sphere_e1_06.out
35: Output output\sphere_e1_07.out
37: Output output\sphere_e1_08.out
40: Output output\sphere_e1_09.out
50: Output output\sphere_e1_10.out
The sphere program can be run along with the sim file using the following command:
java gui.GUI -batch -steps:51 -sim:<file-location>sphere.sim -program:<file-location>sphere.cpa
The output files contain the information required to view the snapshot of the cells at any particular instant. They can be viewed using the Cell Simulator Display Client (provided with CellSim). Make sure you set the correct path, classpath etc., by running init_env.bat of CellSimClient
java CellSimClient <Output-file-location> <cell-size> <X rotation> <Y rotation> <Z rotation> [ < "box" / "sphere" > ]
University of Virginia Department of Computer Science Programming the Swarm |
|
David Evans evans@cs.virginia.edu Selvin George selvin@cs.virginia.edu |