Coder Social home page Coder Social logo

chenterry85 / flocking-simulation Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 39 KB

๐ŸŽ† A visualization of Craig Reynold's Boids

Python 100.00%
simulation python boids-simulation boids boids-algorithm boids-behaviour flocking flocking-simulation flocking-agents flocking-boids

flocking-simulation's Introduction

Flocking Simulation

Flocking is a simulation that consists of boids in groups. The boids maneuver around to simulate real-life flocking behavior such as birds and fish. Boid is short for bird-oid, but they are just generic objects that interact with other boids to form flocks. Even after being seperated by obstacles, all boids will gradually conform back into groups. Each boid follows three behaviors: separation, alignment, and cohesion.

  • Separation: A boid does not want to be too close to other boids.
  • Alignment: A boid wants to move in the same direction as the others.
  • Cohesion: A boid wants to stay close to the other boids.

Requirements

  • Python 3.6+

Installation

#clone the project
git clone https://github.com/chenterry85/Flocking-Simulation.git

#install dependencies
python3 -m pip install -U pygame==2.0.0.dev6 --user

#run program
python3 main.py

Controls

Press:

  • "Left Click" โ†’ add new boid
  • "Right Click" โ†’ add new obstacle
  • "โ†‘" arrow key โ†’ speed up boid
  • "โ†“" arrow key โ†’ slow down boid
  • "r" key โ†’ randomize boid position
  • "c" key โ†’ clear canvas

flocking-simulation's People

Contributors

chenterry85 avatar

Stargazers

 avatar  avatar

Watchers

 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.