Coder Social home page Coder Social logo

mirankavinda / life-of-cells-simulation Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 2.0 7 KB

A colorful twist on Conway's Game of Life, with changing colors for each new cell.

Home Page: https://mirankavinda.medium.com/life-of-cells-simulation-conways-game-of-life-a-fascinating-world-of-cellular-automata-8608ce753f48

Python 100.00%
pygame python simulation

life-of-cells-simulation's Introduction

Life Of Cells - Simulation (Conway's Game of Life)

This is a simple implementation of Conway's Game of Life using the pygame library in Python.

game_of_life_demo

Description

Conway's Game of Life is a cellular automaton devised by mathematician John Conway. It is a zero-player game, meaning its evolution is determined by its initial state, with no further input required. The game consists of a grid of cells, each of which can be either alive or dead. The game evolves in steps based on a set of rules:

  • Any live cell with fewer than two live neighbors dies (underpopulation).
  • Any live cell with two or three live neighbors survives.
  • Any live cell with more than three live neighbors dies (overpopulation).
  • Any dead cell with exactly three live neighbors becomes a live cell (reproduction).

Features

  • Click on cells to toggle their state between alive and dead.
  • Press the spacebar to start or pause the simulation.
  • Press c to clear the grid and reset it to a random initial state.
  • Press g to generate a random pattern of living cells on the grid.

Requirements

  • Python 3
  • Pygame library

Usage

  1. Clone this repository to your local machine:

    git clone https://github.com/mirankavinda/Life-Of-Cells-Simulation.git
    
  2. Navigate to the project directory: cd game-of-life

  3. Install the required dependencies (Pygame): pip install pygame

  4. Run the simulation: python life-of-cells.py

Controls

  • Left Mouse Button: Toggle the state of individual cells (alive/dead).

  • Spacebar: Start or pause the simulation.

  • c Key: Clear the grid and reset it to a random initial state.

  • g Key: Generate a random pattern of living cells on the grid.

Credits

  • The Game of Life rules were devised by John Conway.

  • Special thanks to TechwithTim for their tutorial on John Conway's Game of Life using Python and Pygame, which served as an inspiration for this project.

life-of-cells-simulation's People

Contributors

mirankavinda avatar

Stargazers

Piyumi Buddhini avatar DinuShi 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.