/GameOfLife

"Game of Life" is a cellular automation simulaion developed in C++ using the SFML library.

Primary LanguageC++

Game of Life with SFML

This project is a simulation of Conway's "Game of Life" cellular automaton, implemented in C++ using the SFML library.

Requirements

To run this project, you need to have the SFML library installed on your computer. You can download SFML from the official website: https://www.sfml-dev.org/.

Installation

  1. Clone the repository to your local machine.
  2. Open the project directory in a terminal or command prompt.
  3. Compile the project using the C++ compiler of your choice (e.g. g++).
  4. Run the executable file generated by the compiler.

Usage

When you run the program, you will see a window displaying a grid of cells. The cells are either alive (white) or dead (black). The simulation starts in a paused state.

To randomize the board, press the "R" key. This will generate a random pattern of live and dead cells.

To start the simulation, press the "Enter" key. The cells will start evolving according to the rules of the "Game of Life".

To pause the simulation, press the "P" key. The cells will stop evolving.

You can also click on the cells to change their state manually.

Rules

The "Game of Life" follows these rules:

  1. Any live cell with fewer than two live neighbors dies, as if by underpopulation.
  2. Any live cell with two or three live neighbors lives on to the next generation.
  3. Any live cell with more than three live neighbors dies, as if by overpopulation.
  4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.

Preview

GameOfLife.mp4