This simulation tries to simulate a brain made up of cells that act together as a larger being. It is very basic, but it can be interesting. Each cell is represented at the right of the screen as a square - they are in a 5x5 grid. Each one can send a binary (yes or no) input to each of its neighbors - yes being represented by a green triangle pointing at that neighbor. The cell has a different response to each combination of inputs. When you launch the program, it sets all of these to random values.

Four cells are "input cells" - they output all true or all false to their neighbors based on a property in the virtual world that this "brain" is acting in. The brain controls a dot in the left side of the screen. The "input cells" go on when the dot goes too far up, down, left, or right respectively. If it goes ever further, the program starts "killing" cells - it sets them to new random behaviors, one cell per frame. Along with the input cells, there are four output cells - one of their sides makes the dot move up, down, left, or right respectively instead of giving input to another cell. Eventually, the cells interacting and being reborn can create patterns that stay inside the acceptable area. In order to see this more easily, I included some keyboard functions-

-spacebar to speed up or slow down - in "fast mode", the program will run as fast as it can; in "slow mode", it will run at four frames per second.
-P to pause
-O to draw a trail of where the dot has been, instead of just drawing its current position. Pressing O again changes back.

Because the program runs at four frames per second, you will have to hold these buttons for a while before they work.

For analysis, the program exports a csv file called "position.csv" of the x and y coordinates of the white dot at every frame. The coordinate plane goes from (-50, -50) to (50,50). If the white dot goes past the edge of the screen, it goes to the other side (wrapped screen).

If you enable trail drawing, you may see patterns that last for a short amount of time before the dot goes back to moving chaotically. If you don't see anything happening, the brain may have formed a "stable pattern" that it will continue until you close the program.

You will notice some white lines in the area with the white dot. The middle set are used to trigger the "input cells", and the outer set are used to trigger "brain damage" (cells are randomly reprogrammed).

It is difficult for the program to come up with a stable pattern; I found that actually manually programming a working pattern was very complex. If you hold the T button, it will reprogram the brain to this pattern. However, it will probably only work if the dot is within the middle set of white lines - these are used to trigger the "input cells".

To launch, extract the folder and double click on "Brain Simulator.bat". Works on Windows with Java 6 or later.

Built With

Share this project: