Game of Life, Redo
1 Conway's Game of Life
- Any live cell with
- < 2 live neighbours dies (as if caused by under-population).
- 2 or 3 live neighbours lives on to the next generation.
- > 3 live neighbours dies (as if by over-population).
- Any dead cell with exactly three live neighbours becomes a live cell (as if by reproduction).
- https://en.wikipedia.org/wiki/Conway's_Game_of_Life
1.1 GUI Needs of GoL
- A (stationary) grid of cells; infinite in x and y axes
- Draw/Erase a cell; filled? color?
- Control: speed, size, …
- Themes: colors, circle, square, …
- Kbd/Mouse/Touch interface
- Extensible (plugins)
1.2 Observations
- Inherently concurrent
- Systolic (as in heart beat)
- Non-Trivial: Correct implementation of the rules
- Non-Trivial: Infinite grid
- Non-Trivial: Detecting rule applicability
2 Open Source GoL Implementations
2.1 Edwin Martin's Implementation
- http://www.bitstorm.org/gameoflife/code
- A quick tour
- Java files 18, xml files 2
- Java SLOC 1549, xml SLOC 769
- Browse Game-Of-Life files generated by Doxygen
- Uses Java JDK 1.1
import java.awt.*
2.2 Other Implementations
- https://github.com/Dricus/game-of-life "A small practice project for doing Test Driven Development and doing basic 2D stuff with JavaFX." Java, JavaFX and XML; Open Source Code, 2014
- http://pmav.eu/stuff/javascript-game-of-life-v3.1.1/ Javascript, Canvas
- https://www.youtube.com/watch?v=Ti8cXWvclKo&list by "ForseenParadox"; cliams to have programmed in 1 hour while video recording
- Google Play for Android has several APKs. Probably not open source.
3 Game of Life Redo
- Re-write/ Refactor/ Annotate/ Document GoL
- Concurrent design and implementation
- Event driven design and implementation
- Wiki has several patterns – all these must "work"
- Tabs, one GoL running in each
- Look elegant
- A portion of the above is Lab L2
- http://codegolf.stackexchange.com/questions/88783/build-a-digital-clock-in-conways-game-of-life/
4 Concurrency
- Non-Trivial: Correct implementation of the rules
- Inherently concurrent
- The rules must be evaluated concurrently.
- Assuming systolic (i.e., like a heart beat) updates
5 References
- https://rosettacode.org/wiki/Conway's_Game_of_Life GoL is programmed in many PLs.
- https://en.wikipedia.org/wiki/Conway's_Game_of_Life
- https://bitstorm.org/gameoflife/ A respectable implementation. Uses old Java.