Abstract

The project was to create a simple agent simulation. The purpose of this project was to learn about time Linked Lists, iterators, generics, nodes, and how data structures in java work. By using Nodes which hold data, and point to the next node I made my own Linked List class. I used this class to hold Agents which I could update using the Linked List iterator.

Methods

The computer science concepts used in this project included LinkedList, generics, Nodes, and iterators. All of these concepts are applied in various data structures, and used to make them more accessible.

Specifically, in this project I used Linked List to hold the Agent class. Each Agent was held in a different Node. The Linked List was made using a generic so any object type would work within it. It had an iterator which I used to update each Agent in the linked list.

Results

Here is an image of the normal Social Agents with a radius of 15 after they were allowed to stabilize:

Here is an image of the Social Agents with a radius of 30:

Note there are more stable groups, and they aren't as close together as in the previous simulation.

 

CatSocialAgents will only stay in a group if the majority of the members in that group are of the same category.

Here's a CatSocialAgent simulation with two categories and a radius of 20:

Here is the same simulation with a radius of 40:

Here it is again with a radius of 90:

 

Extensions

I wrote three new agents with different behavior. AntiSocialAgent will only stabilize if it does not have any neighbors. LimitSocialAgent will only stabilize if it has 2 or 3 neighbors. AverageSocialAgent follows the same rules for groups as Social Agent, but it moves a random amount in the direction of the average of its neighbors positions. I also wrote a Simulation class which uses command line parameters to take in the radius, and to decide which Agent simulation to run. 

Reflection

I learned about generics, iterators, Linked Lists, and Nodes in this project. All of these skills helped me make more data structures.