000%

Conway's Game of Life Simulator

<!-- Conway's Game of Life made with JavaFX. -->

&Role

  • * Developer

&Stack

  • * Java
  • * JavaFX
  • * Maven
  • * JUnit

&Year: * 2024

&Type: * Personal

A Game of Life I made with JavaFX. You get a grid of cells and some buttons: Play (it becomes Pause), Increment to do one generation, Clear, and Randomize to fill the board with random cells. A speed choice (Slow, Medium, Fast) changes the time between two generations, and a counter shows the generation number.

The rules are the 4 classic ones. A live cell with fewer than 2 or more than 3 neighbors dies, a live cell with 2 or 3 neighbors stays alive, and a dead cell with exactly 3 neighbors becomes alive. The edges of the board are walls, there is no wrapping. Each cell has an age, and the color changes when a cell survives more than one generation, so you can see what is new and what is stable.

I wrote unit tests with JUnit for the board, the cells, the directions and the states. There is also an INFECTED state in the code, with its own color, but I didn't do the logic for it yet.

Highlights

@Age of the cells

The color of a live cell changes when it survives more than one generation.

@Unit tests

The board, the cells, the directions and the states are tested with JUnit.

@Infection

There is an INFECTED state in the code with its own color, but the logic is still a TODO.