Giter Club home page Giter Club logo

bimile's Introduction

Creates a animated GIF file of a simulated Biham–Middleton–Levine traffic model

Function

The Biham–Middleton–Levine traffic model is a form of cellular automata in which a number of red and blue squares (cars) are places randomly on a grid. Red cars will always try and move right, but can only do so if that cell is unoccupied. Blue cars will always try to move down, but like the red cars, cannot do so if the way is blocked. This can create some very interesting animations.

Usage

bimile.py [-h] [--frame-skip FRAME_SKIP] [--cell-size CELL_SIZE]
                 scale density frame_count

Positional arguments:

scale The number of cells high and wide the grid will be. Try to keep this less than a few hundred.

density The density of the traffic, with 0.0 meaning no cells will be occupied, and 1.0 meaning all cells will be occupied. It is best to keep the density between 0.3 and 0.6, with <0.3 usually causing a free flowing system, and >0.6 causing a globally jambed system.

frame_count The number of frames in the output GIF. This is also usually the number of simulation steps that will be run, but that can be modified via --frame-skip

Optional arguments:

-h, --help show this help message and exit

--frame-skip FRAME_SKIP The number of spaces that the cells should move in each frame. To increase the number of simulation steps in the output GIF, it is a good idea to use this in conjunction with --frame-count so that fewer frames need to be rendered (see Warnings). However this will increase simulation processing time.

--cell-size CELL_SIZE The number of pixels high and wide each cell will be rendered as. Increasing this number will increase the size of the GIF, and excessive cell sizes can cause imagemagick to crash (see Warnings)

Warnings

Attempting to generate excessively large GIFs will usually cause imagemagick to crash.

bimile's People

Contributors

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