Conway's Game of Life in ncurses
Given, a rule and a grid:
- apply the rule to the grid to produce a new grid,
- use ncurses to display the new grid, and
- then wait a short period of time (e.g. 1/2 a second)
© 2016 Powershop
The game will be written in Ruby, and will use the ncurses-ruby
gem to
display the game in ncurses
in a terminal window.
- The neighbourhood will be the Moore neighbourhood of a cell.
- The grid will not resize if the terminal window changes mid-game.
- The initial grid will be all off-pixels with one on-pixel in the centre.
- cell: a single pixel of the Game of Life, either on or off
- grid: a 2D matrix of cells, fit to the size of the terminal window
- neighbourhood: a 2D matrix around a cell, containing all cells which might be able to influence the centre cell.
- rule: a set of transformations from neighbourhoods into cells for the next step of the game