Giter Site home page Giter Site logo

bl33h / conwaysgameoflife Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 48 KB

A real-time rendering program with Conway's Game of Life algorithm.

License: MIT License

CMake 1.57% Shell 1.07% C++ 97.36%
algorithm cmake conways-game-of-life cpp make sdl2 wsl gcc

conwaysgameoflife's Introduction

conwaysGameOfLife

This program simulates the Game of Life on a virtual 2D grid. The simulation uses a framebuffer to represent the grid, and each cell in the grid can be in one of two states: alive or dead. The simulation follows the rules of the Game of Life:

  • Any live cell with fewer than two live neighbors dies (underpopulation).
  • Any live cell with two or three live neighbors lives on to the next generation.
  • Any live cell with more than three live neighbors dies (overpopulation). Any dead cell with exactly three live neighbors becomes a live cell (reproduction).

The simulation is initialized with a random pattern of cells, and then it updates the grid following the Game of Life rules. The grid is displayed in a window using the SDL library.


pic

FilesFeaturesHow To Use

Files

  • configure.sh: A shell script to set up the project dependencies and environment.
  • build.sh: A shell script to build the project using CMake.
  • run.sh: A shell script to execute the compiled graphics application.
  • clean.sh: A shell script to clean up build artifacts and generated files.
  • src: A directory containing the source code files for the graphics application.
    • colors.h: Header file that defines the Color struct and functions for manipulating colors in the application.
    • framebuffer.h: Header file containing the framebuffer and functions for drawing and filling polygons.
    • point.h: Header file defining the Vertex struct, representing a vertex in a polygon.
    • main.cpp: The main C++ source file that implements the graphics application.
  • CMakeLists.txt: The CMake configuration file that manages the build process.

Features

The main features of the graphics application include:

  • Framebuffer: The application uses a framebuffer, defined in framebuffer.h, to represent a virtual screen. The framebuffer allows manipulation and display of colors on the screen.
  • Color Manipulation: The colors.h file defines the Color struct, representing an RGB color. It provides functionality to create colors, perform arithmetic operations (addition and multiplication), and clamp color values within a specified range.
  • Polygon Drawing: The application can draw and fill polygons on the virtual screen using the framebuffer.h functions.
  • Shell Scripts: The project includes convenient shell scripts (configure.sh, build.sh, run.sh, and clean.sh) to set up the environment, build the project, run the application, and clean up build artifacts, respectively.

These features enable the creation and rendering of graphical elements using a framebuffer approach, making it suitable for various computer graphics applications and projects.

How To Use

To clone and run this application, you'll need wsl and the following tools installed on it: Git, C++ compiler, CMake, Make and SDL2. From your command line:

# Clone this repository
$ git clone https://github.com/bl33h/conwaysGameOfLife

# Open the project
$ cd conwaysGameOfLife

# Give execution permissions
$ chmod +x configure.sh
$ chmod +x build.sh
$ chmod +x run.sh

# Run the app
$ ./run.sh

conwaysgameoflife's People

Contributors

bl33h avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.