GameOfLife.mp4
Welcome to the Conway's Game of Life lab, where we'll be implementing Conway's cellular automaton using C++ and the SDL2 library for graphical visualization. The goal is to simulate the behavior of cells in a two-dimensional world, following simple rules that determine their life, death, and reproduction.
Before you start, ensure you have the SDL2 library installed on your system. You can find information on how to install SDL2 here.
The project is organized into three main files:
color.h
: Defines theColor
structure used to represent colors in the game.framebuffer.h
: Contains theFramebuffer
structure that manages the drawing and simulation of the game.main.cpp
: The entry point of the program, where the SDL window is created and managed.
- Clone this repository to your local system.
- Make sure you have SDL2 installed on your system.
- Compile the program using a C++ compatible compiler.
- Run the compiled program.
The program includes the following features:
- Visual representation of live and dead cells in a graphical window.
- Implementation of Conway's algorithm with survival and reproduction rules.
- Different predefined initial patterns, such as blocks, beehives, gliders, and more.
- Continuous animation that simulates the game's turns.
You can customize the window's resolution and animation speed by modifying the WINDOW_WIDTH
, WINDOW_HEIGHT
, and SDL_Delay()
values.
You can add initial patterns to the world using functions like addBlock()
, addBeeHive()
, addGlider()
, and many more defined in Framebuffer
.
This lab was implemented by José Pablo Kiesling.
Enjoy exploring and experimenting with the fascinating world of Conway's Game of Life! If you have any questions or issues, feel free to contact pkiesling@gmail.com.