Code Monkey home page Code Monkey logo

game-of-life's Introduction

Conway's Game of Life using piksel

A piksel-based implementation of the popular Game of Life created by J.H.Conway.

This implementation uses a simple toroidal grid, meaning that the bottom and top edges are considered adjacent, and the same goes for the left and right edges.

Requirements

  • A C++ compiler supporting the C++11 standard
  • CMake (version 3.12 or greater)

Build

After cloning this repository, add piksel by typing:

git clone --recursive https://github.com/bernhardfritz/piksel.git

You can then compile the main executable using CMake:

mkdir build
cd build
cmake ..
make

If you want to modify the existing code, you might be interested in using the DEBUG(msg) macro (defined in src/debug.hpp), which allows to print the message msg on the terminal. You can used it in a cout-like style, e.g.,

int val = 0;
std::string s("hello")
DEBUG("Initialized 'val' to " << val << " and 's' to " << s);

To see the messages, you need to enable the "DEBUG" option as in cmake .. -DDEBUG=ON or using CMake's GUI.

"Play" the game

You can run the app using any of the following commands:

./game_of_life
./game_of_life size
./game_of_life width height

The second one creates a squared grid whose side is of given size, while the last form allows to specify the grid dimensions individually.

Once the app is running, you should see a Glider in the middle of the grid. You can click anywhere on the grid to create or destroy a cell. Use the space bar to start/pause the game, and the "+" and "-" keys on the numpad to increase/decrease the speed of the game.

Enjoy!

game-of-life's People

Contributors

francofusco 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.