From Wikipedia, the free encyclopedia:
The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. The game is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves, or, for advanced players, by creating patterns with particular properties
The evolution of the cells follows this four simple rules:
- Any live cell with fewer than two live neighbors dies, as if by underpopulation.
- Any live cell with two or three live neighbors lives on to the next generation.
- Any live cell with more than three live neighbors dies, as if by overpopulation.
- Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
This is a implementation of Conway's life game written on go.
For graphical implementation, the ebiten 2d engine was used.
The implementation has the following modes.
- Random fill mode
- Drawing mode
- Mode of ready-made figures
In this mode, the first generation of cells is randomly generated.
Random mode can be started by pressing the key (G)
.
Then press the key Enter
to start the game.
Drawing mode will allow you to experiment by creating new shapes with the mouse
Press the key ESC
for stopping the game.
Then you can draw the shape with the LCM(left click mouse)
.
For the eraser, hold the Lshift(left shift)
and use the left mouse button
to delete the cells.
The ready-made shapes' mode allows you to use ready-made shapes from this list.
The list will be updated.
- Glider
Press the number
of the shape you want to use.
The shape will be drawn on the screen.
And for rotate the shape, press the RCM(right click mouse)
.
other tips for managing the game can be found in the upper left corner
To quickly start the game, use this command.
go run -tags=example github.com/fr13n8/game-of-life@latest