The Conway's Game of Life ... Done for a school project in 2014, it was a very challenging and ambitious project but also very interesting.
After spending some hours analysing Conway's theory, the challenged was proposed to the class to built a Java application that could simulate the Game of Life.
With this came several requirements such as:
- Ability to enable/disable cells via mouse click.
- Ability to read a matrix from a file and load it.
- Ability to write current matrix to file.
- Zoom and Speed
- Spherical Matrix
So naturally there was some pressure to make it all work within the schedule provided.
From the beginning, problems soon arrived, main issue was "how to draw a grill that could visually interpret-ate the matrix cells ? ", initially I thought of creating a buffered image that could be manipulated as the simulation occurred, problem with this was the processing time, since it was generating an image on every iteration of the simulation, proving it to be slow and cpu consuming.
In the end, a JPanel was used and lines were drawn within it to make look like a matrix, from there customization was done, spending some hours in the GUI making it looking as good as i could.
The engine part was very tricky because its when you pass from the theory to the action.
Naturally that happened with a multidimensional array that could accommodate the matrix size, and a cycle was programmed so that it analysed every cell on each iteration pass, this way the system could apply Conway's rules depending on the cell state.
Unfortunately not all went accordingly to plan on this one, as the application bypasses a couple of rules I wrote and does not renders exactly as Conway's describes.
However the GUI part of it works very well and the logic can easily be fixed in a future enhancement.
Very exciting project that took a lot of hours in front of the screen but I was very happy with the end result.
Categories: Application Development
Start: Jan, 2013
End: Feb, 2013