OOP_D9_PROJECT/OOP_D9_Project/Rules

45 lines
3.1 KiB
Plaintext

### Description of the Rules for the Multi-Agent Simulation Game
The Multi-Agent Simulation game is based on the famous "Game of Life" by John Conway, and it has been extended to include additional agents and rules to create a more complex and dynamic environment. Here is a brief description of the rules governing the game:
#### Conway's Game of Life Rules
1. **Grid-Based World**: The world is represented as a grid of cells where each cell can be either alive (1) or dead (0).
2. **Neighbor Counting**: Each cell interacts with its eight neighbors (horizontal, vertical, and diagonal).
3. **Rules of Evolution**:
- **Underpopulation**: A living cell with fewer than two live neighbors dies.
- **Survival**: A living cell with two or three live neighbors lives on to the next generation.
- **Overpopulation**: A living cell with more than three live neighbors dies.
- **Reproduction**: A dead cell with exactly three live neighbors becomes a living cell.
#### Extensions with Agents
In addition to the basic cells, the simulation includes agents such as herbivores and predators that introduce new behaviors and interactions:
1. **Herbivores (formerly Sheep)**:
- **Movement**: Herbivores move randomly within the grid.
- **Hunger**: Herbivores have a hunger level that increases over time. If they do not find food (cells they can consume), they eventually die of hunger.
- **Reproduction**: Under certain conditions, herbivores can reproduce if they meet specific criteria (e.g., proximity to another herbivore).
2. **Predators (formerly Wolves)**:
- **Movement**: Predators also move randomly but are more likely to move towards herbivores.
- **Hunting**: Predators hunt herbivores. When a predator encounters a herbivore, it consumes the herbivore, resetting its hunger level.
- **Hunger**: Like herbivores, predators have a hunger level that increases over time. If they do not find food (herbivores to eat), they eventually die of hunger.
#### Grid Boundaries
The grid can have two types of boundary conditions:
1. **Closed Border**: Cells on the edge of the grid have fewer neighbors (cells beyond the grid are considered dead).
2. **Looping Border**: The grid wraps around, meaning the edge cells consider the opposite edge cells as neighbors, creating a continuous loop.
#### Custom Rules
Players can define custom rules for cell birth and survival:
- **Survival Rules**: Specify the number of neighbors required for a cell to survive.
- **Birth Rules**: Specify the number of neighbors required for a dead cell to become alive.
#### Interaction with the Simulation
Players can interact with the simulation using a graphical user interface (GUI) to:
- **Toggle Cells**: Click on cells to toggle their state (alive/dead).
- **Add Agents**: Place herbivores and predators at specified locations.
- **Control Simulation**: Start, pause, and stop the simulation, and adjust the speed of the simulation.
This dynamic environment creates a complex and evolving simulation where players can observe patterns, emergent behaviors, and the interactions between different types of agents and cells.