
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 😸
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.
- Supports over 500_000 cats for rendering
20_000 chosen for comfortable demo
- You can zoom and drag the screen for better viewing experience
- You can scare cats so that they run away from the cursor
- You can set a custom image for the cats or use predefined with Tom
- You can turn on logs of cat interactions
- "Follow" mode for a specific cat
Double-click on the cat you want to follow (labeled with ⭐), and press 'F' to release him
make build # or just "make"
make run
./.venv/bin/python main.py [OPTIONS]
./.venv/Scripts/python main.py [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.
Option | Description | Default |
---|---|---|
--radius FLOAT | set the radius of the points (cats) | 5 |
--use-texture, --no-use-texture | enable cat texture for points | disabled (use colors) |
--num-points INT | set the number of points (cats) in the simulation | 500 points |
--fight-radius INT | set the radius of the fight zone for cats, must be smaller than hiss-radius | 15 |
--hiss-radius INT | set the radius of the hissing zone for cats, must be larger than fight-radius | 30 |
--window-width INT | set the width of the application window | 1000 pixels |
--window-height INT | set the height of the application window | 800 pixels |
--debug, --no-debug | enable debug messages | disabled |
Distributed under the MIT License. See LICENSE for more information.