Skip to end of metadata
Go to start of metadata

Justin Gelwicks


Project 4: Agent-Based Simulations– Grouping behaviors the purpose


The purpose of this project was to work with linked lists in order to implement an agent-based simulation. We do this to create a display of agents that group together, however, unlike the Conway’s Game of Life project, the agents, themselves, move around. This Project also stressed the idea of subclasses– we created the Agent class in order to create the properties of the agents and the methods that can be associated with them, but then, for instance, the SocialAgent class extends the agent class. The Social agent class is a subclass of Agent which means that it inherits its methods and values, but some methods can be overwritten to do different things, like creating a different updateState method to change how the agents act. In the end, we created simulation classes to view the behaviors of the agents.



 In the SocialAgent class, the method updateState was tricky because I had to create a method that would bring the agents closer together. In order to do this, I tested that if the size of the neighbors' stack was greater than 3 it would not move. The size of neighbors was dependent on a given radius. To move the objects that were not within that radius, I moved them in random directions until they found a “clump”. This lead to the clumping seen in the display:


This project was a good way to understand how linked lists as well as creating parent classes and subclasses in order to achieve a task. It was rewarding to see how much we can change about the nature of a simulation just by changing a few lines.


TA Hours

Office hours: Layton