Skip to content

☘️ Conway's Game of Life on C language for terminal Linux

License

Notifications You must be signed in to change notification settings

FezzMad/Game-of-Life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conway's Game of Life

Conway's Game of Life on C language for terminal Linux.

Libraries

Installing the ncurses library in Debian/Ubuntu Linux:

$ sudo apt install ncurses-bin
  • unistd - for the delay between cards in microseconds
  • stdio - for other primitive actions (e. g. printf())
  • stdlib - for working with memory

Compilation

Go to the Game-of-Life folder and enter in the terminal:

$ make

Compiled by Game_of_Life. Run Game_of_Life in the terminal:

$ ./Game_of_Life

Gameplay

When you start the game, you are greeted by a welcome picture

img

You will be asked if you want to upload a finished image

$ Do you want to upload ready-made coordinates?[Y/N]

Picture from file

If you answer yes, you will be asked to enter the name of the image file with the extension 'txt'

$ Enter the name of the prepared picture with the extension 'txt':

Here the picture is a text file containing a matrix of zeros and ones. Examples are given in the Game-of-Life folder.

Example of the uploaded image:

$ Enter the name of the prepared picture with the extension 'txt':
$ Butterfly.txt

butterfly

Picture from coordinates

If you answered "no", then you should draw the image yourself using the cursor. How to use it is written below

Control

You can interfere with the gameplay and introduce new live cells. To do this, activate the cursor using the 'K' key. If you press this key while the cursor is active, the cursor disappears from the screen. To enter a live cell, press 'ENTER' when the cursor is active. To move the cursor around the field, use 'W', 'A', 'S', 'D' - up, left, down, right.

You can change the speed of the game, use the keys to do this '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'.

You can pause the game by pressing the 'SPACE'. To resume the game, press the space bar again.

If you forget which keys are responsible for what, you can call for help using the 'H' key. In this case, the game will be paused.

To exit the game, press the 'ESC' key.

Settings

If you want to change drawing symbols, you can do it in constants.h.

#define SYMBOL_BORT '='
#define SYMBOL_BORT_SIDE 'N'
#define SYMBOL_DEATH ' '
#define SYMBOL_LIVE '#'
#define SYMBOL_K_LIVE 'L'
#define SYMBOL_K_DEATH 'D'

About

☘️ Conway's Game of Life on C language for terminal Linux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published