Skip to content

The Game of Life implemented using Raylib in C provides a graphical simulation of Conway’s Game of Life. Raylib is a simple and efficient C library for creating 2D and 3D games, making it ideal for visualizing cellular automata like Life.

License

Notifications You must be signed in to change notification settings

C-JeanDev/Game-Of-Life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game of Life - Raylib Edition

📜 Description

This is a Conway's Game of Life implementation using Raylib. The Game of Life is a famous cellular automaton created by John Conway, where cells evolve based on simple rules.

🎮 Features

  • Pause and resume simulation
  • Randomize initial state
  • Manual cell activation/deactivation
  • Adjustable simulation speed
  • Simple and efficient rendering using Raylib

🔬 Rules of Conway's Game of Life

The Game of Life is a zero-player game where the evolution of a grid of cells follows simple rules. Each cell can be alive or dead, and its state in the next generation is determined by its neighbors.

📜 Rules:

  1. Underpopulation: A live cell with fewer than 2 live neighbors dies.
  2. Survival: A live cell with 2 or 3 live neighbors stays alive.
  3. Overpopulation: A live cell with more than 3 live neighbors dies.
  4. Reproduction: A dead cell with exactly 3 live neighbors becomes alive.

🎯 Key Concepts:

  • The game runs on a grid (finite or infinite).
  • Each step generates a new state based on the above rules.
  • The process continues indefinitely or until a stable pattern is reached.

🔄 Common Patterns:

  • Still Life: Patterns that don’t change (e.g., Block, Beehive).
  • Oscillators: Patterns that cycle through states (e.g., Blinker, Toad).
  • Spaceships: Patterns that move across the grid (e.g., Glider, Lightweight Spaceship).

🛠 Requirements

  • Raylib (latest version recommended)
  • C/C++ Compiler (GCC, Clang, MinGW, etc.)
  • Make (to use the Makefile)

🚀 Installation & Execution

  1. Clone the repository:
    git clone https://github.com/C-JeanDev/Game-Of-Life.git
  2. Makefile:
    make clean && make && ./game.out
    

🕹️ Controls

  • SPACE → Pause/Resume simulation
  • C → Clear grid
  • R -> Randomize Grid
  • Left Click → Toggle individual cell state
  • Up/Down Arrows → Increase/Decrease simulation speed
  • ESC → Exit the game

📸 Screenshots And Videos

Random Start

random_gameoflife

A single Gosper's glider gun creating gliders

random_gameoflife Screenshot from 2025-03-30 20-01-43 Screenshot from 2025-03-30 20-02-00

📄 License

This project is licensed under the MIT License.

About

The Game of Life implemented using Raylib in C provides a graphical simulation of Conway’s Game of Life. Raylib is a simple and efficient C library for creating 2D and 3D games, making it ideal for visualizing cellular automata like Life.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published