This repository contains an implementation of Conway's Game of Life, a classic cellular automaton devised by mathematician John Conway. The program is written in C++ and is designed to be efficient, modular, and easy to use.
Conway's Game of Life is a zero-player game, meaning its evolution is determined by its initial state and requires no further input. It consists of a grid of cells, each of which can be alive or dead. The state of the grid evolves in steps based on the following rules:
- Underpopulation: A live cell with fewer than two live neighbors dies.
- Survival: A live cell with two or three live neighbors continues to live.
- Overpopulation: A live cell with more than three live neighbors dies.
- Reproduction: A dead cell with exactly three live neighbors becomes a live cell.
This program simulates these rules and displays the evolution of the grid over time.
- Efficient Implementation: Optimized for performance in C++.
- Customizable Grid Size: Define the size of the grid at runtime.
- Interactive or Preset Patterns: Start with manually defined patterns or use preset ones (e.g., gliders, oscillators).
To build and run this project, you need:
- A C++ compiler (e.g., GCC, Clang, MSVC)
- CMake for build automation
- A terminal or console environment
-
Clone the repository:
git clone https://github.com/DavidHavoc/conwaysgameoflifecpp.git cd conwaysgameoflifecpp -
Build the project using CMake:
mkdir build cd build cmake .. make -
Run the executable:
./game_of_life
If you want to enable the documentation generation or testing, you can pass those options when configuring CMake:
cmake -DBUILD_DOCS=ON -DBUILD_TESTS=ON ..Once the program is running:
- You can input the grid size and choose a starting pattern.
- The simulation will display the grid in the terminal.
Contributions are welcome! If you’d like to improve the project, feel free to:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request for review.
This project is licensed under the MIT License.
- Inspired by John Conway's original concept of the Game of Life.
- Special thanks to the open-source community for their tools and libraries.