Git Product home page Git Product logo

masimpygame's Introduction

MASimPyGame

Implementation of multi-agent simulations in PyGame.

Current examples cotain flocking, aggergation and disease spread.

Contents

  1. main.py The main file to execute, can specify here the general simulation settings:

    • the number of agents
    • screen size
    • swarm type (which experiment to run)
  2. simulation folder Contains the general simulation design, as well as general multi-agent classes with properties that can be shared across the experiments.

    • simulation.py The main execution loop: the simulation is initialized and ran until the user exits the window.
    • swarm.py General swarm properties and updates
    • agent.py General agent properties and updates
    • physical_objects.py General obstacle properties
    • helperfunctions.py General vector transformation functions
  3. experiments folder Contains separate folder for each experiment:

    • flocking
    • aggregation
    • covid
  4. flocking folder Contains detailed characteristics of a flocking behavior

    • flock.py defines the environment of the flock, as well as specific flocking related functions
    • boid.py defines a boid, with its possible actions and update rule
    • images folder where the images for the environment and boid design is stored
  5. aggregation folder Contains detailed characteristics for aggregation behavior

    • aggreagte.pydefines the environment of the aggregation simuation
    • cockroach.py defines the specific agent actions
  6. covid folder Contains experimental set-up for modeling disease spread based on the SIR model

    • population.py defines the properties of the population, such as initial infected proportion
    • person.py define the properties of each individual

How it works

Simply run the main.py file from terminal by specifying the type of swarm to use, and the number of agents

If you want to change the specific behavior of the given swarm, look into the corresponding swarm folder, and adjust the global variables

Have fun!

Examples

Here are some flocking examples:

Boids outside a circle object

Output sample

Boids inside a circle object

Output sample

Boids inside a convex object

Output sample

Here is an Aggregation collective behavior example:

Output sample

Here are simple disease spread example:

Output sample

masimpygame's People

Contributors

ilzeamandaa avatar alfjesus3 avatar drasgo avatar atilla50 avatar

Stargazers

 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.