fr13n8 / game-of-life

An implementation of Conway's Game of Life.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conway's Game of Life

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:

  1. Any live cell with fewer than two live neighbors dies, as if by underpopulation.
  2. Any live cell with two or three live neighbors lives on to the next generation.
  3. Any live cell with more than three live neighbors dies, as if by overpopulation.
  4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.

About implementation

This is a implementation of Conway's life game written on go.
For graphical implementation, the ebiten 2d engine was used.

Usage

The implementation has the following modes.

  1. Random fill mode
  2. Drawing mode
  3. Mode of ready-made figures

Random fill mode

In this mode, the first generation of cells is randomly generated.

Usage:

Random mode can be started by pressing the key (G).
Then press the key Enter to start the game.

Random fill mode

Drawing mode

Drawing mode will allow you to experiment by creating new shapes with the mouse

Usage:

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.

Drawing mode

Mode of ready-made figures

The ready-made shapes' mode allows you to use ready-made shapes from this list.
The list will be updated.

  1. Glider

Usage:

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).

Drawing mode

other tips for managing the game can be found in the upper left corner

Install

To quickly start the game, use this command.

go run -tags=example github.com/fr13n8/game-of-life@latest

About

An implementation of Conway's Game of Life.


Languages

Language:Go 100.0%