- Another category
- I added a third, red category. This made clumping even less likely, since having having 3 different categories effectively decreased the likelihood that a neighboring cell was of the same category.
- "Instead of making separate main classes for each type of simulation, write just one Simulation class and make it possible for the user to control the type of SocialAgents from the command line."
- I created a new class called Simulation that lets the choice of simulation be decided from the command line.
- General Command-line arguments
- As suggested in the instructions, I added command-line arguments that let the user control the landscape size, number of agents, number of time steps, and which simulation to run (0 for no category, 1 for categorized). If the user doesn't input any arguments, then it will use default values. I put in a check to make sure that people don't try to put in too many arguments; if they do so, then the program will print a usage statement and quit.
- "See if you can mix and match different agent types and write about what happens."
- I changed the color of the SocialAgent (non-categorized agents) to black. Then I made some modifications to my CategorizedSocialAgent class using the instanceof keyword so that it would only do the category check if the agent in the list is a CategorizedSocialAgent. If not for this, it would try to check the category of regular SocialAgents, thereby throwing an error.
- I set this as choice #2 in the command line argument. This will create half categorized, half regular social agents. I found that life was sad for a regular social agent. Their social agent peers would clump with them, but when they tried to clump with CategorizedSocialAgents, the CSAs didn't want to hang out. In other words, SAs would pause when in a clump of CSAs, but CSAs wouldn't be affected by the presence of an SA.
- Changing radius:
- I tried radii 5, 10, 15, 25, 35, 45, 55, 85 in sequential order. As one would expect, these caused the agents to go from moving around all the time, to almost always being at a standstill.
- I found that the difference between 45, 55, and 85 weren't all that much. This was because at such a big radius, agents tended to have the minimum requisite neighbors and thus almost every agent was moving solely due to the 1% chance conditional.
- Changing neighbor requirement
- I experimented with changing the number of neighbors required to use the 1% chance to move conditional. I tried: 1,2,3,4,5,6.
- As the number of required neighbors increased, there was much more movement for agents. It seems likely, therefore, that with these test values, the most movement would be with a radius of 5 and neighbor requirement of 6 and the least movement would be with radius 85 and 6 neighbors required.
- Background Music
- Adapting my extension from last time, I decided that since these Agents are looking for friends, this program plays the Friends theme song when running the Simulation class. If this annoys you while testing, please comment out line 26 in Simulation.java.
I learned a lot about the underlying data structure of this project: linked lists. This project also gave me more experience with inheritance and OOP.