Screen.Recording.2024-01-07.at.1.11.56.AM.mp4
ant_man is a simulation of ant behavior using pygame in Python. The simulation includes features such as ant movement, pheromone trails, food seeking, and nest navigation. This readme provides an overview of the code structure, key components, and logic.
- Python 3
- pygame library
pip install pygame- Clone the repository:
git clone https://github.com/Eeman1113/Esoteric_Languages_Adventures.git- Navigate to the project directory:
cd Esoteric_Languages_Adventures- Run the simulation:
python nants.py-
Ant Class (
Ant):- Represents an ant in the simulation.
- Ants have various behaviors such as random wandering, food seeking, and nest navigation.
- Uses pygame for drawing and updating ant positions.
-
PheroGrid Class (
PheroGrid):- Represents the pheromone grid that ants leave behind.
- Pheromones decay over time and affect ant behavior.
- The class uses pygame to update and display the pheromone grid.
-
Food Class (
Food):- Represents food items in the simulation.
- Ants seek out and pick up food.
-
Ant Behavior:
- Ants exhibit random wandering until they encounter food or the nest.
- Pheromone trails are left behind by ants as they move.
- Ants follow pheromone trails when seeking food and returning to the nest.
-
Pheromone Trails:
- Pheromone levels decay over time.
- Ants reinforce pheromone trails when seeking food and returning to the nest.
-
Food Seeking:
- Ants detect the presence of food based on color.
- When finding food, ants either follow their own trail back to the nest or head towards the nest.
-
Nest Navigation:
- Ants navigate towards the nest using pheromone trails.
-
Wall Avoidance:
- Ants avoid walls by adjusting their direction when wall colors are detected.
- Left-clicking on the simulation window spawns food items.
- Right-clicking on a food item picks it up.
- The simulation can run in fullscreen or windowed mode based on the
FLLSCRNvariable.
- Icons and images used in the simulation may be missing or are optional (nants.png, background.png).
This project is licensed under the MIT License - see the LICENSE file for details.
ant_man provides a simple yet interesting simulation of ant behavior. Users can observe how ants interact with their environment, leaving pheromone trails and seeking food. The code is well-documented and can be easily extended or modified for experimentation and learning purposes.