-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
63 lines (55 loc) · 2.08 KB
/
main.py
File metadata and controls
63 lines (55 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
# main.py - Main entry point for AI Sheep Herding Simulation
"""
AI Sheep Herding Simulation with Advanced Neighbor Selection
This simulation demonstrates advanced AI concepts including:
- Limited perception and neighbor selection algorithms
- Multi-criteria decision making with weighted features
- Online machine learning for strategy adaptation
- Emergent behavior through simple rules
- Strategic positioning and herding tactics
The shepherd dog uses machine learning to intelligently select which sheep
to focus on, rather than trying to herd the entire flock at once.
Author: AI Assistant
Date: 2025
"""
import sys
import os
# Add current directory to Python path for imports
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
# Import and run the simulation
from environment import main
if __name__ == "__main__":
print("=" * 60)
print("AI SHEEP HERDING SIMULATION")
print("Advanced Neighbor Selection Algorithm")
print("=" * 60)
print()
print("This simulation demonstrates:")
print("• Limited perception AI (dog can't see whole flock)")
print("• K-nearest neighbors with strategic selection")
print("• Multi-criteria decision making")
print("• Online learning and weight adaptation")
print("• Emergent flocking behavior")
print("• Strategic positioning behind targets")
print()
print("Controls:")
print("• SPACE: Pause/Resume simulation")
print("• R: Reset simulation")
print("• D: Toggle debug information")
print("• V: Toggle vision radius display")
print("• C: Toggle connection lines")
print("• Left Click: Move target location")
print("• ESC: Exit simulation")
print()
print("Watch how the AI dog learns and adapts its strategy!")
print("The feature weights will change over time based on performance.")
print()
print("Starting simulation...")
print("=" * 60)
try:
main()
except Exception as e:
print(f"\nError occurred: {e}")
print("Make sure you have pygame installed: pip install pygame")
sys.exit(1)