Skip to content
/ go-life Public

A fast and scalable implementation of Conway’s Game of Life in Go running in the terminal. Supports both boarded boards and sparse infinite boards.

License

Notifications You must be signed in to change notification settings

nbu/go-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Game of Life

A fast and scalable implementation of Conway’s Game of Life in Go running in the terminal.
Supports both boarded boards and sparse infinite boards.

Features

  • Infinite board mode (sparse storage, scales to very large grids).
  • Boarded board mode with fixed width/height determined by the widht and height of the terminal.
  • Terminal rendering (via termbox-go).
  • Keyboard controls for pausing and adjusting speed.
    • pause: <SPACE>
    • quit: <ESC>
    • speed up/down: +/-
    • pan board with arrows: left, right, up and down
    • reset board origin: r
  • Unicode characters for smooth board visualization.
  • Statistics tracking:
    • Generation count
    • Alive cells
    • Born / Died cells per tick

Run

Clone repo:

git clone https://github.com/nbu/go-life.git

Run code:

cd go-life
# Get usage info
go run . --help

# Run simulation for 100 generation on the infinite board with 50ms step interval using objects/spaceship/canadagrey.cells initial layout file
go run . -s 50ms -g 100 -t infinite -f objects/spaceship/canadagrey.cells

# Run random board for 1000 generations with 100% population on the infinite board with 10ms step interval
go run . s -p 100 -s 10ms -g 1000 -t infinite

Demo

Demo

About

A fast and scalable implementation of Conway’s Game of Life in Go running in the terminal. Supports both boarded boards and sparse infinite boards.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages