CS 261 Homework 2 - Zombie Infection Simulator

Due Wed Feb 13 at 9:00am Extended to Fri Deb 15 at 9:00am

Overview

In this assignment, you will create an agent-based simulation of the zombie apocalypse and the spread of the zombie-ism. This simulation will be based on that designed by Kevin Davis http://kevan.org/proce55ing/zombies/ (Yyu can test out the demo on that site). A screenshot of an example run in our system is below: In this picture, green dots are zombies, pink dots are humans, and yellow dots are people who are panicking. The outbreak started from a single zombie.

You are welcome to work individually or in pairs on this assignment.

Objectives

Necessary Files

You will want a copy of the Hwk2.zip file which contains the the basic code to display your simulation. (You are perfectly capable of writing this code your self and are welcome to modify--I am providing this code to get you started). This zip archive contains three files: ZISFrame.java (the GUI frame that displays the simulated City; this also has a main method), City.java (the beginnings of the City class that will be a part of your simulation), and the README.txt for the assignment.

Be sure to carefully look over the City class in particular. You will need to make substanial modifications and additions to this file (including filling in some of the provided methods)---it might not even compile in its current form!

Details

Submitting

BEFORE YOU SUBMIT: make sure your code is fully documented and functional! If your code doesn't run, I can't give you credit!

Submit your program to the Hwk2 submission folder on hedwig, following the instructions detailed in Lab A. You should upload Agent.java, Human.java, Zombie.java, PanickedHuman.java, City.java, ZISFrame.java and the README.txt.

The homework is due at the start of class on Wed Feb 13.

Plan of Attack

This is a large complex program and it's hard to know where to begin. Here is a rough plan of attack for how to start making this thing work (compiled from memory of how I implemented the program):

  1. Make the Human class (and the Agent class it extends) and just try to get them to show up on the screen--randomly spread them throughout the city.
  2. Make the agents be populated in legal areas (e.g., in roads and not in the buildings, and not in the same square. Hint: try making a list of all possible places an agent COULD be and then picking a random item from that list)
  3. Make the agents all move in one direction on a tick (e.g., to the left)
  4. Make the agents all move in a random directon on a tick
  5. Test repeatedly that things seem to work
  6. Make the "look forward" method so agents can see if there is a wall in front of them; don't have them walk through walls
  7. Make the agents turn randomly when they hit a wall. This should make them all skitter about in nice ant lines.
  8. Make the agents also "look forward" and turn when they're about to hit another person. This should make them all move randomly.
  9. You'll need to have new positions be tracked both by the Agent object and by the City object
  10. Test repeatedly that things seem to work
  11. Replace a single agent with a zombie (the start of the outbreak).
  12. Make the "look forward" method allow agents to see far in front of them
  13. Make the zombie move appropriately, as described above.
  14. Have the zombie check if it should bite a person (using the same "look forward" method)
  15. If it bites, tell the city to swap out the Human for a Zombie
  16. Test repeatedly that things seem to work
  17. Use the same general code you used for Zombies to see people to have Humans see zombies
  18. Use the same general code you used for Zombies to bite people to have people panic
  19. Test repeatedly that things seem to work
  20. Clean up any leftover issues or code.

Again, this is a hard one. If you have any problems or questions, feel free to ask!

Extensions

So many options...

Grading

This assignment will be graded based on approximately the following criteria: