The universe of the Game of Life is an infinite, two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, live or dead, (or populated and unpopulated, respectively). Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:
- Any live cell with fewer than two live neighbours dies, as if by underpopulation.
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies, as if by overpopulation.
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
These rules, which compare the behavior of the automaton to real life, can be condensed into the following:
- Any live cell with two or three live neighbours survives.
- Any dead cell with three live neighbours becomes a live cell.
- All other live cells die in the next generation. Similarly, all other dead cells stay dead.
To run the program
Run the GameOfLife.go life in your system by using the command
go run GameOflife.go
The Program ask for necessary inputs like:
- Size of the board to be created.
- Number of Iteration(Gneration) needed to be created
Program provide 2 difference choice of generating the board such as
- User Generated Board -> Where user give the row and column index and program set the values as 1’s at that user given index on the board.
- Auto Generated Board -> Where the program generate the random row and column index and set the values as 1’s at generated index in the board