Xholon - Stupid Model 2 - Bug Growth
What is it
This is the second in a series of 16 "Stupid Models". It's intended as a starting point for learning how to develop grid and agent-based models using Xholon. It can also be used to compare Xholon with other agent-based modeling tools that have also implemented the Stupid Model series.
In this model, bugs grow as well as move. Each bug has an initial size of 1.0, and grows by 1.0 each time step, after moving. When displayed on the grid, bugs start out white and turn redder over time as they grow. The specification states that "Bug colors shade from white when size is zero to red when size is 10 or greater". Because a size of 10.0 is reached in only 10 time steps, which happens almost instantaneously, Xholon does the shading between 0.0 and 255.0 .
The bug grow() method is in BugStupidModel2.java .
The algorithm for determining the display color is in GridPanelStupidModel2.java . One specific bug is shown in green to make it easy to follow.
The speed is intentionally slowed down considerably to make it easier to watch the bugs move. You can speed it up by changing TimeStepInterval in StupidModel2_xhn.xml from its current value of 100. This is the number of milliseconds the simulation sleeps between time steps. A value of 0 produces the greatest speed.