Git Product home page Git Product logo

crowd_sandbox's Introduction

Concurrent programming experiment with hyper simplistic "crowd" simulations

I want to learn more about concurrency and don't want to just play with trivial examples. So, this project is to serve as a test bed for my concurrency experimentation.

This project allows dozens of Bots to move around the screen and collide with each other. There are several kinds of Bots, each with its own simple pre-programmed logic that defines how it moves about the screen.

The thought is to see how hard/easy it is to implement these different bots with different approaches to concurrency. Some possibilities:

  • step based simulation
  • threads
  • generators
  • asyncio
  • Twisted
    • async
    • threads

In addition to running the simulation (letting the Bots run around), the app also provides keyboard controls to interact with the simulation (pause time, advance frame by frame, add and remove bots, move bots, etc.)

Project Setup

# Create venv
py -3 -m venv venv
source venv/Scripts/activate
# Install dependencies
pip install -r requirements.txt
cd src/
python -m crowd.crowd_sandbox

PyCharm

  • Set venv/ as project interpreter in PyCharm
  • Mark src/ directory as "sources root"

Repo layout

  • src/
    • minimal/: minimal example apps comparing the use of synchronous code, threading, multiprocessing and asyncio
    • common/: shared utilities
    • crowd/: original implementation of crowd_simulation
    • crowd_thread/: thread-based implementation of crowd_simulation
    • crowd_multiproc/: multiprocessing-based implementation of crowd_simulation
    • crowd_async/: asyncio-based implementation of crowd_simulation

crowd_sandbox's People

Contributors

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