Code Monkey home page Code Monkey logo

conways-game-of-life's Introduction

Conways Game of Life

Conway's Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. The game is played on a grid of cells, where each cell can be either alive or dead.

Rules:

The universe of the Game of Life is an infinite, two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, live or dead (or populated and unpopulated, respectively). Every cell interacts with its eight neighbors, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

1- Underpopulation: Any live cell with fewer than two live neighbors dies.

2- Survival: Any live cell with two or three live neighbors survives to the next generation.

3- Overpopulation: Any live cell with more than three live neighbors dies.

4- Reproduction: Any dead cell with exactly three live neighbors becomes a live cell.

These rules create fascinating patterns and behaviors, making the Game of Life a classic example of emergent complexity.

Usage:

Conway's Game of Life has various applications and uses:

1- Simulation: It's often used as a simulation tool in biology, ecology, and other fields to model population dynamics and spatial interactions.

2- Algorithmic Exploration: The Game of Life provides an interesting platform for exploring and developing algorithms, especially for tasks like pattern recognition and optimization.

3 - Visualizations: Many artists and designers use the Game of Life to create visually stunning patterns and animations.

4- Educational Tool: It serves as an educational tool for teaching concepts like cellular automata, emergent behavior, and algorithmic thinking.

Examples:

Here are a few examples of patterns that can emerge in Conway's Game of Life:

1- Still Life: Patterns that remain unchanged throughout generations.

image

2- Oscillators: Patterns that oscillate between two or more states.

oscillator

3- Spaceships: Patterns that move across the grid in a consistent direction.

mwss

4- Glider Gun: A pattern that continuously produces gliders, which are spaceships moving diagonally. (You can find the codes in the jupyter notebook.)

gosper_glider_gun

Getting started:

In order to begin the simulation you need to have these libraries installed:

NumPy, Matplotlib and PIL

You can easily install the libraries via the following command:

pip install [name of the library]

You can also manipulate the rules of the game to see what will happen if you chanhe the rules of the game. A few examples are included in the file, like game of life considering the second neighbor, dead cells have a chance to come to life and etc.

Feel free to share your opinions regarding this project.

conways-game-of-life's People

Contributors

mahyar-e 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.