Conway's Game of Life

Conway's Game of Life

For my Advanced Topics in Computer Science (Java) course, we were tasked with coding a cellular automata based on Conway's Game of Life. This challenge had many layer to it, such as creating a cell class, using enums to keep track of previous and current states of each cell, and implementing the game rules. While I came up with my own way to apply the Moore rules, my teacher recommended a more efficient method that used boolean arrays, where the index corresponded to the number of dead or alive neighbors, and the boolean indicated the next state of the cell. My method certainly worked, but this version allowed for easier changes to the rules, and taught me the importance of learning from the people around you.

0:00
/0:20

As part of an optional extension I played around with various modifications like allowing the cells to wrap around the edge (ie. the leftmost cell is counted as adjacent to the rightmost cell), but the extension I ultimately chose to focus on was designing a version in which the traditional square cells were replaced with hexagons. This extension challenged my mathematics skills, as correctly displaying the hexagons was a challenge. I spent much of my time drawing on the white board and sketching special triangles to successfully calculate the coordinates of each vertex. I also had to reverse engineer these equations to make the cells clickable, but it was ultimately worth it to see the final working product.

In these two clips you can see two modes I coded: randomly filled cells, and clickable cells.

0:00
/0:04
0:00
/0:07

I coded this project in Java using the Processing library, and you can see my code here: https://github.com/kmlewis361/GameOfLife