GithubHelp home page GithubHelp logo

cellular-automata's Introduction

Cellular Automata

Introduction

This is a simple cellular automata program with two built in rules. One is a rule I made up. Another is Conway’s Game of Life’s rule. The default rule is conway’s and it has been mentioned in the config file.

KEYS

  • SPACE-Pause/Play
  • ESC-Quit
  • UP/DOWN/LEFT/RIGHT-Pan Up/Down/Left/Right
  • F/G-Zoom in/Zoom out from keyboard
  • Mouse Scroll-Zoom in or out
  • Left Click-Toggle grid cells state
  • Mouse Middle button click and Drag-Pan

Setting up the grid by clicking

Initially the system is PAUSED, i.e you may freely click on the cells to make initial state. Clicking on the grid will toggle their states changing from dead to alive. Black cells are alive ones. Pressing SPACE will PLAY/PAUSE the system. In any time you may pause and alter the program’s state by clicking the grid to make it dead or alive. Zoom in or Zoom out with mouse scroll. Pan with mouse key press. UP,DOWN,LEFT,RIGHT arrows may be used to navigate around. The grid is virtually infinite.

Setting up the grid by config file

You may see in “config.json” some configuration. Size is the inital grid state i.e provided is of 50 rows and 80 columns. You may change it. You may manually put locations like [1,2], etc inside like ‘individual’:[[1,2], [2,3] ], but who would do that instead of just clicking on the grid. And in the range section “rows” and “cols” control rows and colums which are alive i.e coloured black. Given default is [20,30] in rows and just below it is [30,60]. Remember to match [] in rows and cols i.e for each [] in row there must be one [] in column. The rule is simple, what I have given colors rows from 20 to 40 and cols form 30 to 60 to black. If you want to color entire rows or columns just put [] in the rows if you want to select entire rows, and [] in columns for entire columns. Messing up the json file may throw error, if there are any syntax errors, so be careful while altering “config.json”. The ‘function’ is ‘conway’ by default. There is only another function or lets just say rule which is pretty useless.

Start clean

If you want to start with clean grid just make the “rows”:[] and “cols”:[] in the “config.json” file

Run

pip install -r requirements.txt
python main.py

cellular-automata's People

Contributors

ashvinoli avatar

Watchers

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