-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (24 loc) · 1.12 KB
/
main.py
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
from classes import Kitchen, Dishes, Clients, Counter, Courier, create_paralel_process
def main():
# Remember:
# Kitchen, Clients and Couries must work independently at ALL TIMES. They must be separated into different processes.
# Create the dishes
stilt_dishes = [
Dishes(name="Steak", prep_time=5),
Dishes(name="Roasted Potatoes", prep_time=8),
Dishes(name="Pasta", prep_time=6),
Dishes(name="Fried Chicken", prep_time=3),
Dishes(name="Baião", prep_time=9),
]
# Create the counter where the food will rest
stilt_counter = Counter()
# Create the couriers that will deliver the food
stilt_couriers = Courier(stilt_counter)
# Create the kitchen itself, presenting all the objects that came before
stilt_kitchen = Kitchen(stilt_dishes, stilt_counter, stilt_couriers)
stilt_clients = Clients(stilt_kitchen)
# Now, after initializing the clients, it will bombard the kitchen with orders
clients_ordering_process = create_paralel_process(stilt_clients.initiate_ordering)
clients_ordering_process.start()
if __name__ == '__main__':
main()