- Overview
- Rules
- Simulation model
- Requirements
- Build and run
- Configuration
- Known implementation details
- License
This project implements Conway's Game of Life in C++. A two-dimensional grid evolves in discrete generations: each cell's next state depends on the number of live cells in its neighborhood.
The simulation renders the grid in a terminal and generates an initial population randomly.
For each generation:
- A live cell with fewer than two live neighbors dies.
- A live cell with two or three live neighbors survives.
- A live cell with more than three live neighbors dies.
- A dead cell with exactly three live neighbors becomes alive.
flowchart TD
A[Allocate grid] --> B[Generate initial population]
B --> C[Print current generation]
C --> D[Count neighbors]
D --> E[Apply Life rules]
E --> F[Create next generation]
F --> G{Any live cells remain?}
G -->|Yes| C
G -->|No| H[Print final generation]
The neighbor calculation wraps coordinates at the grid edges, producing a toroidal world rather than a grid with dead borders.
- C++ compiler
- Linux/POSIX environment (the source uses
unistd.h,usleep(), andclear)
git clone https://github.com/Edumarek123/jogoDaVida.git
cd jogoDaVida
g++ -std=c++11 -O2 -Wall -Wextra main.cpp -o game_of_life
./game_of_lifeThe source includes a delay of approximately 100 ms between generations.
The grid dimensions are currently defined in main.cpp:
| Variable | Current value | Meaning |
|---|---|---|
Tamanho_X |
105 | Number of rows |
Tamanho_Y |
585 | Number of columns |
Change these values before compiling to experiment with different grid sizes. Large dimensions require a terminal capable of displaying the output.
The current implementation uses dynamically allocated matrices and a random initialization routine. The initialization and memory-management code would benefit from further review before the simulation is used as a robust or long-running program.
This project is licensed under the GNU General Public License v3.0 only (GPL-3.0-only). You may use, study, modify, and redistribute this project under the terms of the license.
See LICENSE for the complete license text. Third-party components and assets remain subject to their own licenses and notices.