๐Ÿ“ฆ AzimMuradov / drunk-cats

Drunk cats simulator :smile_cat:

โ˜… 2 stars โ‘‚ 0 forks ๐Ÿ‘ 2 watching โš–๏ธ MIT License
spbu
๐Ÿ“ฅ Clone https://github.com/AzimMuradov/drunk-cats.git
HTTPS git clone https://github.com/AzimMuradov/drunk-cats.git
SSH git clone git@github.com:AzimMuradov/drunk-cats.git
CLI gh repo clone AzimMuradov/drunk-cats
Artem Rzhankov Artem Rzhankov Update arch.md 6a5011c 12 months ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ backend
๐Ÿ“ data
๐Ÿ“ frontend
๐Ÿ“ tests
๐Ÿ“„ .gitignore
๐Ÿ“„ arch.md
๐Ÿ“„ LICENSE
๐Ÿ“„ main.py
๐Ÿ“„ Makefile
๐Ÿ“„ mypy.ini
๐Ÿ“„ README.md
๐Ÿ“„ requirements.txt
๐Ÿ“„ README.md

drunk-cats

logo

drunk-cats is an application for simulating the interactions between objects in a limited area. The objects have specific behavior patterns (see interactions). The app is also have a quite flexible configuration of simulation parameters (see run options).

Cats were chosen just as the model objects :smile_cat:

Interactions

Expressed by the following rules:

  • If two cats are at a distance not exceeding r, they try to start a fight with a probability of 1.
  • If two cats are at a distance R > r, they start hissing with a probability inversely proportional to the square of
the distance between them.

  • If there are no rivals around the cat, it calmly walks.
At the same time, cats move within a limited area.

Features

  • Supports over 500_000 cats for rendering
many<em>cats</em>demo

20_000 chosen for comfortable demo

  • You can zoom and drag the screen for better viewing experience
zoom<em>and</em>drug_demo

  • You can scare cats so that they run away from the cursor
cursor push demo

  • You can set a custom image for the cats or use predefined with Tom
texture feature demo

  • You can turn on logs of cat interactions
logging_demo

  • "Follow" mode for a specific cat
Double-click on the cat you want to follow (labeled with :star:), and press 'F' to release him

follow_mode

Setup

make build # or just "make"

Run

Using make

make run

Using python directly

Linux, MacOS

./.venv/bin/python main.py [OPTIONS]

Windows

./.venv/Scripts/python main.py [OPTIONS]

Run Options

The application provides extensive options for configuring the simulation through command-line arguments.

These settings allow users to easily adapt the simulation to their needs by changing visual parameters, the number of cats, and their interaction rules.

OptionDescriptionDefault
--radius FLOATset the radius of the points (cats)5
--use-texture, --no-use-textureenable cat texture for pointsdisabled (use colors)
--num-points INTset the number of points (cats) in the simulation500 points
--fight-radius INTset the radius of the fight zone for cats, must be smaller than hiss-radius15
--hiss-radius INTset the radius of the hissing zone for cats, must be larger than fight-radius30
--window-width INTset the width of the application window1000 pixels
--window-height INTset the height of the application window800 pixels
--debug, --no-debugenable debug messagesdisabled

License

Distributed under the MIT License. See LICENSE for more information.