The task in this project was to get comfortable with the linked list data structure. By the end we were iterating thru linked lists, converting them to other data structures like ArrayLists and 2d arrays, and inputting and outputting from the linked list. It was helpful to use a linked list in the background with other data structures in the front because it allowed us to put the visualizeable part of the data, that is the data that kept within certain bounds, in an array while all of the data resided in a linked list. I thought the cool part of this assignment was turning the linkedlist into an Arraylist using an iterator subclass, and then turning that ArrayList into a 2d array that could in turn be converted into a string for printing. Four different kinds of data, each with their own advantages and drawbacks, but all occupying a niche in the overall algorithm.
The point of the simulation was to make a game of life-like simulation of group behavior. Like last week, cell objects made up the most fundamental data we worked with. These cells had properties like moving when they are far from other cells, or moving only when they are near a certain type of cell, or moving when they are close to any type of cell. Examples of the start field and 9th iteration of those different types of cells are below:
interestingly, the cells that are attracted to other cells, and the cells that are repelled by other cells, each form a similar pattern after 9 iterations. Those cases are represented by the first and third pairs of images. Computers prove it: given a tight space, misanthropes and socialites will look about the same. The case with self loving cells, who are attracted to their own kind and repulsed by the others, gives interesting results. The groups seem to arrange in stripes and I'm not sure why.
As a small extension I made the simulation class take command line arguments.
Bilal and Erin helped me with this project, as well as Stephanie and Bruce.