Skip to content

arjunmahishi/game-of-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game of Life

A simple(ish) program that simulates Conway's Game of Life on the terminal.

Running it

Build the binary

$ make build

Simulate an existing pattern

There are a few patterns saved in the ./patterns directory. These patterns are simple text files with a 2D matrix of 1s and 0s representing the initial state of the simulation

$ ./bin/life patterns/butterfly-hatch

Create your own pattern

Create a pattern file similar to the ones in ./patterns. Just create a 2D matric with 0s representing dead cells and 1s representing alive cells.

Example

$  cat canvas.txt

00000000000000000
00000000000000000
00011111111111000
00000000000000000
00000000000000000

Dont worry about the size of the matrix. During the simulation the size will be adjusted to center the pattern in your terminal window.

Run it

$ ./bin/life canvas.txt

Output

More options

$ ./bin/life --help

Usage of ./bin/life:
  -canvas-only string
        Empty canvas
  -empty string
        Empty cell character (default " ")
  -filled string
        Filled cell character (default "")
  -freq int
        Refresh frequency (default 100)
  -line-space string
        Line space character
  -no-color
        Disable colors

About

Game of life simulation on the terminal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published