-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
110 lines (97 loc) · 3.59 KB
/
Copy pathconfig.py
File metadata and controls
110 lines (97 loc) · 3.59 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# config.py - Centralized configuration for AI Sheep Herding Simulation
"""
Configuration file for the AI Sheep Herding Simulation.
This structure matches the expected format used by the ShepherdDog class.
Modify these values to customize behavior, performance, and visual appearance.
"""
# Screen and Visual Settings
SCREEN_WIDTH = 1200
SCREEN_HEIGHT = 800
FPS = 60
# Dog AI Configuration
DOG_CONFIG = {
'size': 12,
'max_speed': 3.5,
'vision_radius': 150, # How far the dog can see sheep
'max_targets': 5, # Maximum number of sheep to target at once
'herding_distance': 40, # Optimal distance to maintain behind sheep
'strategy_update_interval': 30, # Frames between strategy updates
'positioning_tolerance': 15, # How close to target position is "close enough"
# ML Algorithm weights for strategic sheep selection
'neighbor_weights': {
'distance': 0.4, # Weight for proximity to dog
'isolation': 0.3, # Weight for sheep isolation from flock
'target_distance': 0.2, # Weight for distance from gathering point
'movement': 0.1 # Weight for movement direction alignment
}
}
# Sheep Configuration (refactored to follow DOG_CONFIG structure)
SHEEP_CONFIG = {
'count': 25,
'size': 8,
'max_speed': 2.0,
'max_force': 0.1,
# Flocking behavior parameters grouped together
'flocking_params': {
'separation_radius': 25,
'alignment_radius': 50,
'cohesion_radius': 50,
'separation_weight': 2.0,
'alignment_weight': 1.0,
'cohesion_weight': 1.0,
},
# Fear and response to dog grouped together
'fear_response': {
'fear_radius': 60, # How close dog can get before sheep panics
'fear_strength': 1.5, # How strongly sheep react to dog
'max_fear_level': 100 # Maximum fear value
}
}
# Environment Configuration
ENVIRONMENT_CONFIG = {
'boundary_buffer': 50, # Minimum distance from screen edges
'target_position': (SCREEN_WIDTH - 100, SCREEN_HEIGHT // 2),
'target_size': 20
}
# Color Scheme
COLORS = {
'background': (34, 139, 34), # Forest green
'sheep': (255, 255, 255), # White
'dog': (139, 69, 19), # Saddle brown
'target': (255, 0, 0), # Red
'text': (0, 0, 0), # Black
'debug': (255, 255, 0), # Yellow for debug lines
'dog_vision': (139, 69, 19, 50) # Semi-transparent brown for vision radius
}
# Debug and Visualization Settings
DEBUG_CONFIG = {
'show_dog_vision': True, # Show dog's vision radius
'show_target_lines': True, # Show lines to targeted sheep
'show_sheep_states': False, # Show sheep fear levels and states
'show_ai_info': True, # Show AI decision information
'print_ai_decisions': False, # Print AI decisions to console
'show_trails': False, # Show movement trails
'trail_length': 20 # Length of movement trails
}
# Performance Settings
PERFORMANCE_CONFIG = {
'max_fps': 60,
'vsync': True,
'render_distance': 1000 # Don't render objects beyond this distance
}
# AI Learning Parameters (for future enhancement)
LEARNING_CONFIG = {
'learning_rate': 0.01,
'weight_adaptation': True,
'experience_buffer_size': 1000,
'update_frequency': 100 # Frames between learning updates
}
# Physics Settings
PHYSICS_CONFIG = {
'boundary_force': 0.5,
'edge_margin': 50,
'collision_damping': 0.8,
'friction': 0.95
}
# Export commonly used values for easy access
TARGET_LOCATION = ENVIRONMENT_CONFIG['target_position']