jfgreen / gameoflife-termbox

An interactive terminal implementation of Conway's Game of Life.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Game Of Life - Termbox

Game Of Life

Yet another Go implementation of Conway's Game of Life. Mostly an excuse to learn and practise the language but also to test out Termbox Go.

Running

To start a randomly initialised game:

go run main.go

To load and run a particular pattern, specify a path to a valid Life 1.6 file:

go run main.go -file pattern.lif

The Game Of Life Wiki has a collection of 3000+ patterns in this format.

Command line flags

  -alive string
    	Character to use to render alive cells. (default "●")
  -file string
    	Path of pattern file to initialise game with. Takes precedence over --seed.
  -fps int
    	Frames per second. (default 10)
  -log string
    	Path of logfile to write debugging messages to. (default "/dev/null")
  -seed int
    	Seed to be used in initialisation of random life.

Controls

  • Spacebar to pause/unpause.
  • Mouse click to toggle cell (if your terminal supports it).
  • R to restart game.
  • Q or CTRL-C to exit.

Running tests

go test github.com/jfgreen/gameoflife-termbox/game

Performance

Can run a bit slow on on large terminals, your millage may vary.

About

An interactive terminal implementation of Conway's Game of Life.


Languages

Language:Go 100.0%