Skip to content

DanielVukelich/conway-ncurses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

conway-ncurses

An Ncurses implementation of Conway's Game of Life and other cellular automaton rules

Building

Build a debug version with make, and a version without debug symbols by running make release. The program will be put in the build/ directory. Make sure that you have ncurses-dev or your distro's equivalent package installed.

Running

Running the program without any arguments will launch a random game with Conway's rules. To exit, press 'q'. To pause, press space. When you are paused, you can press 's' to step forward one generation at a time.

The program supports the following optional command line arguments:

  • --file <path> or -f <path>: Loads a Life 1.05 file describing a pattern and optional ruleset.
  • --seed <num> or -s <num>: When generating a random game, 1/num of every cell will be seeded 'alive'. The higher num, the more cells will start as 'dead'. The seed is not allowed to be a value less than 1.
  • --rule <string> or -r <string>: Tells the game what rules determine how cells live and die. If a file input is specified and that file uses tags that tell what ruleset to use, the file's rules will take precedence. Specify rules in the standard Alive/Born format. Eg: Conway's original rules are that a living cell will continue to live if it has 2 or 3 living neighbours, and a dead cell will be reborn if it has exactly 3 living neighbours. This ruleset would be passed as --rule 23/3. If you wanted cells to stay alive if they have an even number of living neighbours and dead cells to be born if they have exactly 1 neighbour, you would use the ruleset --rule 2468/1. Note that since a cell cannot have more than 8 neighbours, the number 9 is not allowed in the rule string. For more information, please read this.
  • --widescreen or -w: Because the characters in a terminal are taller than they are wide, one cell in the game is represented by 2 screen characters. This is so things look more uniformly square. If you would like to have extra horizontal resolution, passing --widescreen will use one character to draw one cell.
  • --edge-wrap or -e: If this flag is enabled, cells will "wrap" around the borders. For example, a glider flying toward into the right border will reappear on the left border (still flying right).
  • --time <num> or -t <num>: This value determines the speed of the simulation in milliseconds. The default value is 250. This value cannot be less than 1.
  • --pause or -p: If this flag is enabled, the game will begin paused (press space to unpause). Useful if you want to examine a pattern at the beginning.

Life 1.05

This program can load files in the Life 1.05 file format. Information about the Life 1.05 file format can be found here.

About

An Ncurses implementation of Conway's Game of life and other Cellular Automaton rules

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published