Coder Social home page Coder Social logo

enguerranvidal / cellular-automatons Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 19.2 MB

This repository focuses on studying and showcasing interesting patterns emerging from simple rules random motion algorithms. It contains a Conway's Game of life made in Python and a second algorithm for an animation of random walk algorithms on a 2D plane.

License: MIT License

Python 100.00%
numpy python3 matplotlib-pyplot matplotlib gif animation random-walk randomwalk game-of-life conways-game-of-life conway-s-game-of-life conway automatons cellular-automaton random-motion python imageio

cellular-automatons's Introduction

RANDOM MOTION / CONWAY'S GAME OF LIFE

This Python project's goal is to simulate different kinds of random motion and emerging patterns from simple rules. It contains a Conway's Game of Life and a Random Walk algorithm all able to create animations in GIF formats through the use of the Imageio and Matplotlib library.

Random Walk :

Imagine a drunk person making steps in 4 random directions : "forward", "backward", "left" and "right" and you keep track of all the position they has been in, making for a marvelous pattern emerging from randomness. That is basically the concept for this part of the project which revolves around a single Python function capable of chossing random steps, keeping track of the tracer's trajectory ( the drunk person ) and create a GIF animation out of it, resulting in something such as what you can see below :

Conway's Game of Life :

This part of the project focuses more on a famous cellular automaton rules which create interesting emerging patterns. The Conway's Game of life is made of a grid which pixels are defined by their state as "dead" or "alive" and follow 4 famous rules :

  • Any live cell with fewer than two live neighbours dies, as if by underpopulation.
  • Any live cell with two or three live neighbours lives on to the next generation.
  • Any live cell with more than three live neighbours dies, as if by overpopulation.
  • Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

We implemented these conditions/rules in the GameOfLife.nextstep method. The code contains a major object called GameOfLife that instigates and runs the simulations but also can withstand the implementation of different boundary conditions and pattern changes. It can also save and load domains if need be, reinitialize himself if you want to see a specific result again, add famous Game of Life pattern/blocks for further study and creativity such as this "glider gun" used in the creation of computers inside the game of life !

  • Glider Gun Pattern

  • Max Pattern

FUTURE ADDITIONS ?

  • The created GIFs are as of now uncompressed and can therefore become quite heavy, we will try to implement a compressing function later on to ease this problem.

  • We will allow the user to show the steps passing through a display in the animation.

  • We will add a receiding trail for the random walk animation instead of the current bright white one.

  • We will try and add more boundary conditions for the game of life algorithm, at least implement toroidal boundary conditions.

  • We will hopefully add a system where an image file could be converted as a txt file and added in the pattern catalogue.

cellular-automatons's People

Contributors

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