automatyczny_kelner/agent.py

40 lines
1.0 KiB
Python
Raw Normal View History

2023-05-14 14:23:37 +02:00
import random
from src.Engine import Engine
from src.obj.Waiter import Waiter
from src.obj.Block import Block
from src.obj.Kitchen import Kitchen
from src.obj.Table import Table
from src.UserController import UserController
from src.StateController import StateController
2023-05-14 14:23:37 +02:00
SCREEN_SIZE = (800, 800)
SQUARE_SIZE = 40
waiter = Waiter([0, 0], 0, SQUARE_SIZE, SCREEN_SIZE)
objects = [
2023-05-14 14:23:37 +02:00
Kitchen([0, 0], 0, SQUARE_SIZE, SCREEN_SIZE)
]
2023-05-14 14:23:37 +02:00
for i in range(150):
pos = [0, 0]
while any([o.compare_pos(pos) for o in objects]):
pos = [random.randint(1, SCREEN_SIZE[0]/SQUARE_SIZE),
random.randint(1, SCREEN_SIZE[0]/SQUARE_SIZE)]
if (random.randint(0, 1)):
objects.append(Block(pos, 0, SQUARE_SIZE, SCREEN_SIZE))
else:
objects.append(Table(pos, 0, SQUARE_SIZE,
SCREEN_SIZE, random.randint(0, 3)))
user = UserController(waiter)
state = StateController(waiter)
2023-05-14 14:23:37 +02:00
engine = Engine(SCREEN_SIZE, SQUARE_SIZE, user, state)
for o in objects:
engine.subscribe(o)
engine.loop()