-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
21 lines (17 loc) · 900 Bytes
/
main.py
File metadata and controls
21 lines (17 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import random
from module import ResponsiveModule
from environment import Environment
from engine import SimulationEngine
# Set random seed for reproducibility
random.seed(21)
if __name__ == "__main__":
# Define the environment bounds as (min_x, min_y, max_x, max_y).
env = Environment(bounds=(0, 0, 100, 100))
# Create a few modules with specified width and height.
for i in range(10):
# Place modules in a random location with some margin from the edge.
pos = (random.randint(20, 80), random.randint(20, 80))
module = ResponsiveModule(module_id=i, position=(int(pos[0]), int(pos[1])), width=random.randint(10, 20), height=random.randint(10, 20))
env.add_module(module)
engine = SimulationEngine(environment=env)
engine.run(steps=100, plot=True, plot_overlap=True, plot_outside=True, plot_action_history=True, pause_time=0.01)