Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Conway's Game of Life

A terminal-based C++ simulation of a cellular automaton.

C++ Concept Platform

Contents

Overview

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.

Rules

For each generation:

  1. A live cell with fewer than two live neighbors dies.
  2. A live cell with two or three live neighbors survives.
  3. A live cell with more than three live neighbors dies.
  4. A dead cell with exactly three live neighbors becomes alive.

Simulation model

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]
Loading

The neighbor calculation wraps coordinates at the grid edges, producing a toroidal world rather than a grid with dead borders.

Requirements

  • C++ compiler
  • Linux/POSIX environment (the source uses unistd.h, usleep(), and clear)

Build and run

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_life

The source includes a delay of approximately 100 ms between generations.

Configuration

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.

Known implementation details

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.

License

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages