2023-05-14 14:23:37 +02:00
|
|
|
import random
|
2023-06-07 12:43:21 +02:00
|
|
|
from termcolor import colored
|
2023-05-05 02:56:22 +02:00
|
|
|
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
|
2023-06-07 12:43:21 +02:00
|
|
|
from src.controller.UserController import UserController
|
|
|
|
from src.controller.StateController import StateController
|
|
|
|
from src.controller.ImageController import ImageController
|
|
|
|
from Network.Predictor import Predictor
|
|
|
|
|
|
|
|
print(colored("Initialization...", "green"))
|
2023-05-05 02:56:22 +02:00
|
|
|
|
2023-05-26 03:02:16 +02:00
|
|
|
SCREEN_SIZE = [800, 800]
|
2023-06-07 12:43:21 +02:00
|
|
|
SQUARE_SIZE = 80
|
|
|
|
SLEEP_DURATION = 0.125
|
|
|
|
|
|
|
|
store = ImageController(SQUARE_SIZE)
|
2023-05-14 14:23:37 +02:00
|
|
|
|
2023-06-07 12:43:21 +02:00
|
|
|
waiter = Waiter([0, 0], 0, SQUARE_SIZE, SCREEN_SIZE, store)
|
|
|
|
kitchen = Kitchen([0, 0], 0, SQUARE_SIZE, SCREEN_SIZE, store)
|
2023-06-01 17:45:01 +02:00
|
|
|
objects = []
|
2023-05-05 02:56:22 +02:00
|
|
|
|
2023-06-07 12:43:21 +02:00
|
|
|
for i in range(25):
|
2023-05-14 14:23:37 +02:00
|
|
|
|
|
|
|
pos = [0, 0]
|
|
|
|
|
2023-06-01 17:45:01 +02:00
|
|
|
while any([o.compare_pos(pos) for o in objects]) or pos == [0, 0]:
|
|
|
|
pos = [random.randint(1, SCREEN_SIZE[0]/SQUARE_SIZE - 1),
|
|
|
|
random.randint(1, SCREEN_SIZE[0]/SQUARE_SIZE - 1)]
|
2023-05-14 14:23:37 +02:00
|
|
|
|
|
|
|
if (random.randint(0, 1)):
|
2023-06-07 12:43:21 +02:00
|
|
|
objects.append(Block(pos, 0, SQUARE_SIZE, SCREEN_SIZE, store))
|
2023-05-14 14:23:37 +02:00
|
|
|
else:
|
2023-06-07 12:43:21 +02:00
|
|
|
objects.append(Table(pos, 0, SQUARE_SIZE, SCREEN_SIZE, store))
|
2023-05-14 14:23:37 +02:00
|
|
|
|
2023-05-05 02:56:22 +02:00
|
|
|
user = UserController(waiter)
|
|
|
|
state = StateController(waiter)
|
2023-06-07 12:43:21 +02:00
|
|
|
predictor = Predictor()
|
|
|
|
engine = Engine(SCREEN_SIZE, SQUARE_SIZE, kitchen,
|
|
|
|
user, state, predictor, SLEEP_DURATION)
|
2023-05-05 02:56:22 +02:00
|
|
|
|
|
|
|
for o in objects:
|
|
|
|
engine.subscribe(o)
|
|
|
|
|
2023-06-07 12:43:21 +02:00
|
|
|
print(colored("Starting model...", "green"))
|
|
|
|
|
2023-05-05 02:56:22 +02:00
|
|
|
engine.loop()
|