[REMOVE ALL COMMENTS SUCH AS THIS ONE BEFORE CHECKING IN.]
[A good approach to creating the README is to take a stab at it before coding, and then fix it up after coding.]
[You may add additional sections to this file if applicable, e.g. ## Deploying
or any other information that a user might find
instructive.]
[How to build the program. VS Code part is optional.]
Command line:
make
to build. An executable calledclife
will be produced.make clean
to clean up all build products except the executable.make pristine
to clean up all build products entirely.
VS Code:
- The default build task runs
make
.
[List files here, even if you only have one. Headers are optional.]
main.c
: The main code to launch the gamelife.c
: Code specific to Conway's Lifedisplay.c
: Code to related to displaysysdetect.h
: Some macros for detecting system capabilities
[Description of the main data used in the program. Just list the major data structures—not every variable.]
There is an 80x24 2D array of Booleans that represents the cells, in row-major order. Additionally, there's a second parallel array used to double-buffer during the next generation computation.
If an array element is True, the cell is alive, otherwise it's dead.
[This is a tree of functions and their short descriptions]
main()
init()
life_init()
: Initializes the cell array to randomgrid_alloc()
: Allocate space for the cell gridrandomize()
: Randomize the contents of the cell grid
display_init()
: Initializes the displayclear_screen()
run()
: Main game running routinelife_update()
: Update cell dataupdate_cell()
: updates a cell based on its neighborsget_neighbor_count()
: counts neighbors for a cell
life_get_cells()
: Get cell statusdisplay_update()
: Display cellshome_cursor()
delay()
: Delay between frames
life_shutdown()
: Call before destruction (currently unreachable)grid_free()
: Free cell grid memory
[Any additional notes, bugs, etc.]
^C
to quit.life_init()
should allow different kinds of initializations, not just random.- UI could be added so the user could draw patterns.
- Maybe add some preprogrammed patterns, spaceships, etc.
- Bug: display totally messed up on screens smaller than 80x24