Giter Club home page Giter Club logo

game-of-life-c's Introduction

Conway's Game of Life Simulator

This was my submission for the Harvard CS50x final project.

Video Demo: https://youtu.be/KB4p_-KxPt4

This program is a terminal application made in C that simulates the Conway's Game of Life Cellular automaton

Installation ๐Ÿ“ฆ

Build ๐Ÿ› ๏ธ

make

Installation (add to bin folder)

make install

Usage

Usage

What is a Cellular Automaton

  • A grid of cells that can have two or more states (e.g. Living or Dead)
  • The grid's state changes during each generation depending on certain rules
  • Cellular automata fascinates researchers because of the very complex behaviours that can emerge from very simple rules

Game of Life's Rules

The rules of the Game of Life cellular automaton are very simple.

Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically and diagonally adjacent.

  • Any living cell with two or three live neighbours survives
  • Any dead cell with three live neighbours becomes a live cell
  • Any other cell die

example1 example2

Defferent entities

An entity is a pattern of cells that have a certain behaviour

There are multiple types of entities for example :

  • Oscillators : patterns that changes but repeat themselves after a particular number of generation (period)

oscillator example

  • Still life : a stable pattern in which no changes follow the initial configuration

still life example

  • Gliders : a glider will move across the environment as a parsistent entity

glider example

Very complex behaviour

Here are two examples of very complex behaviours that have been discovered :

  • The glider gun : A patter that generates gliders

glider gun

  • Life in Life : One day, big brain people discovered a way to create logic gates in the Life (abreviation for game of life), and logic gates are the essense of computers, with logic gates, you can create computers. So these people used Life as sort of a programming language and coded a simulation of the game of life, inside of the game of life. And THIS is an example of the very complex behaviours that I am talking about! https://www.youtube.com/watch?v=xP5-iIeKXE8

Structure of the project

src/main.c

This file manages argument parsing, and is used for starting the simulation

src/utils.c

This file contains usefull fonctions such as sleep_ms, clear_terminal and more so that the main.c file is not too long

src/life.c

This file contains all the logic of the game of life

Uninstall

# ๐Ÿ“‚ game-of-life-c
make uninstall
# This will just delete /usr/bin/golc

final

If you have any problem, dont hesitate to open an issue.

contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

game-of-life-c's People

Contributors

imgbot[bot] avatar skwalexe avatar

Stargazers

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