Introduction: Ant colonies are composed of thousands of individuals that carry out their assigned tasks. The combined individual behaviors of all the ants brings about the emergence of a self-organized system: the colony itself. Each ant only lives for about one year, except for the queen, which can live for 20 years or more. The colony can survive as long as the queen still lives, meaning the colony can also survive for 20 years or more. Since the individual ants only live for about a year, the colony isn't able to benefit from the wisdom of old "wise" ants. The colony lives simply because each individual ant does what it has been programmed to do. The colony you create will consist of a queen and her brood, which will have workers to gather food and dig new tunnels, and soldiers to protect the colony from enemies. The colony will start off with only the queen and a few workers and soldiers. Over time the colony will expand to function like a real ant colony, to a limited (very limited, actually!) extent. Since you will be building a simulation, how your colony behaves will depend on how certain parameters (discussed below) have been set. The purpose of a simulation is to mimic reality as closely as possible, but in many cases there may not be enough facts on hand to build an accurate simulation. In such cases, it is beneficial to build the simulation in a way that allows the various parameters to be changed easily. I will be providing you with values for as many parameters as I can.
General Architecture Requirements: You will be using a simplified Model-View-Controller (MVC) architecture for this project. Therefore your project should be divided into 3 general components: 1) The Model The Model in this project is the ant colony itself, which consists of those classes needed to encapsulate the functionality of the colony. Your Model should contain a "Simulation" class that will be responsible for displaying information to the user interface. Your Simulation class should have a reference to your user interface class (see The View, below). As the simulation runs it will direct its output to the user interface class (this is known as a "push" model). 2) The View The View is the component that allows the human user to see what is going on. It consists of those classes needed to create the graphical user interface, if a GUI is used. If you use the terminal for input/output, the JDK has already provided you with classes to direct output to the terminal window (e.g., System, BufferedReader, etc.). However, you should create a separate class that your Simulation class will use when it displays information about the colony. 3) The Controller The Controller is responsible for selectin the view and mapping that view to the model. For this project the Controller will consist of a single class, "Driver", that contains the main() method and nothing else. Inside the main method you will need to do the following: a) create an instance of your Simulation class b) create an instance of your user interface class c) register your user interface class with your Simulation class (i.e., make sure your Simulation class has a reference to your user interface class) d) start the simulation Output Requirements: On each turn of your simulation you should display the following information using your user interface (the data type you should use is in parentheses): 1) the current day of the simulation (int) 2) the current turn number of the current day (int) 3) the current amount of food in the queen's chamber (int) 4) for each tunnel node in the colony you should display the following: a) the Node ID that uniquely identifies the node; you may use the value returned by the hashCode() method inherited by the Java class Object, if you wish (String or int) b) the number of food units in the node (int) c) the level of pheromone in the node (int) d) for each colony ant in the node display the following information: 1. ID that uniquely identifies the ant; again, you may use hashCode() if you wish (String or int) 2. the type of ant (queen, forager, builder, guard or scout) (String) 3. the age of the ant, in days (int) 4. the amount of food the ant is carrying (only if it is a forager) (int) 5. what the ant's last action was (e.g., picked up food, moved forward, dug a new tunnel to the right, attacked an enemy, etc.); when the queen hatches a new ant you should state what type of ant was hatched (String) e) for each enemy Bala ant in the node, display the following: 1. ID that uniquely identifies the ant; again, you may use hashCode() if you wish (String or int) 2. the age of the ant, in days (int) 3. what the ant's last action was (e.g., moved forward, attacked an enemy) (String) Interface Requirements: You can build your own interface, if you feel like delving into the AWT and Swing components of Java. Or, you can simply have your simulation use the terminal for output. However, you must design your system so that your Simulation class sends information to your user interface class as described under General Architecture Requirements. 1) You must document your code meaningfully (but don't overdo it!). 2) You may not use simple arrays to model the tunnel network or the contents of the tunnel nodes. You may use ArrayLists, however.
MS Windows (see Ant [url removed, login to view] for full project info)