Courses/CS 461/Winter 2006/Jeff Bailey/Homework 5
From CSWiki
Contents |
[edit] Living with Zombies
This week I made further enhancements to my Zombies model to include a natural lifespan for human. In order to best simulate the distribution of lifespans, I created 2 new parameters, stepsToLiveMean and stepsToLiveStdev that are used with a nomal distribution random number generator to determine how many steps an agent lives. I also adjusted panic mode so that people panic if they see another person within their range of vision in panic mode. In this case, the person turns and runs in the same direction as the other person (assumed to be away from a zombie). In order to prevent perpetual panic, I created a cooldown that is double the number of steps a user panics. If they panic for 5 steps, they must cooldown for 10 steps before they can panic again. Panic and vision are now user adjustable.
I had a problem trying to create properties that were adjustable at runtime. I followed the tutorial but the sliders were not being added to the interface so there was a key step not included in the documentation. So, for this version all the properties must be set before runtime.
After making these code changes, I was interested to see if it was possible to maintain a fairly stable human / zombie population.
[edit] Download
Unzip and double click zombies.jar to run.
[edit] Successful Integration
After a great deal of experimenting, I was able to achieve a stable population of humans and zombies. Note the stability of the mutation population.
[edit] Settings
[edit] Population Distribution
Of particular interest here is even distribution of population over the entire city. This may contribute to the population stability by avoiding a zombie takeover in any specific region. The zombies are kept in check by the mutation so it is important that the mutation population remains fairly stable, otherwise the zombie population would die out completely.
[edit] Chart
[edit] Unexpected Sensitivity: Overpopulation
I was surprised to find how sensitive this model was to slight changes. Overpopulation was extremely easy to achieve with minor adjustments. For example, adjusting the StepsToLiveMean (average lifespan) by less than 10% resulted in the major overcrowding of the city.
[edit] Settings
[edit] Population Distribution
Unlike the earlier model, this simulation exhibits a great deal of segregation and the zombies cant compete with the human population growth.
[edit] Chart
Notice the exponential growth of both human (and mutation) populations.
[edit] Unexpected Sensitivity: Mutation Rate
It turns out that a slight change in the mutation rate also has a drastic impact on the ability to maintain a stable zombie population. In this case, I adjusted the default settings to reduce the chance of mutation by 5% (from 30% to 25%).
[edit] Settings
[edit] Population Distribution
[edit] Chart
[edit] Next Steps
Things that I would like to implement:
- Runtime properties (custom actions).
- Make mutation hereditary rather than random.
- Experiment more with the charting api.










