Skip to content

This is a simple implementation of Conway's game of life which uses SDL2 and is written in C.

License

Notifications You must be signed in to change notification settings

TheShoutingParrot/sdl-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdl-life

This program is a simple graphical implementation of Conway's game of life which uses SDL2 and is written in C. Please remember that this implementation is very early in development. Look at the TODO.md file to see this program's TODO list

Alt text

Features

This program currently lacks many features that are to be expected from a full game of life implementation. This program has the following features:

  • All Conway's game of life rules working
  • Support for ALL Life-like rules
  • Pause and resume
  • Zoom in and out
  • Move around the grid
  • Support for reading plaintext cell files (.cells)
  • Add or remove cells by clicking on them

Installation

To install this program you must have the SDL2 development library installed. Finally, make install must be executed on the command prompt, this command will install the program to PREFIX/bin.

This program has been only tested on Linux using X11 on exactly two distrobutions: Void Linux (glib) and Ubuntu.

Usage

This program is an implementation of Conway's game of life. You can run this just by executing sdl-life on the command line. To add cells just left click and you will see a new cell on the grid, if the program isn't paused it will probably disappear immediately after it appears; press the space bar to pause or resume the program. A list of all the keybindings is below.

If you want to see ready made patterns in action you can do that if you have a valid .cells file containing a pattern, then just execute sdl-life -f pattern.cells (replace pattern.cells with the name of your cell file of course) and you will see the pattern stored on the file in action. Currently only the plaintext / .cells format is supported for reading patterns. Reading the most common file format for storing large patterns, the Run Length Encoded file format, should be supported soon.

This program supports all Life-like rules, you can change the rules simply by using the command line argument -r or -rules or -rulestring and after that it is necessary to give the rulestring like so -r RULESTRING. Currently the rulestring must use b/s notation or s/b notation. Example usage of sdl-life using alternative rules: sdl-life -r b36/s23 or with s/b notation: sdl-life -r 23/36; in this example a cell is born if it has 3 or 6 neighbors and a cell survives if it has 2 or 3 neighbors, this is a very popular alternative to Life called HighLife.

Keybindings

-Space					-Pause/Resume
-w/a/s/d				-Move around the grid (up/down/left/right)
-Mouse scroll or PLUS (+) / MINUS (-)	-Zoom in and out
-Left click				-Add cell
-Right click				-Remove cell

Screenshots

Alt text Alt text

sdl-life as seen on Ubuntu gnome.

Alt text Alt text Alt text

As you can see sdl-life supports a plentitude of colors.

Alt text

License information

This project is licensed under the terms of the BSD 2-Clause license, see the LICENSE file for further information.

About

This is a simple implementation of Conway's game of life which uses SDL2 and is written in C.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published