Pobieranie dań z kuchni i rozdawanie ich klientom
This commit is contained in:
parent
ce1c77af47
commit
db80b906da
@ -20,6 +20,7 @@ class Plate(object):
|
|||||||
self.isEmpty = False
|
self.isEmpty = False
|
||||||
self.preparationTime = dish.preparationTime
|
self.preparationTime = dish.preparationTime
|
||||||
self.eatingTime = dish.eatingTime
|
self.eatingTime = dish.eatingTime
|
||||||
|
self.price = dish.price
|
||||||
|
|
||||||
def eat(self):
|
def eat(self):
|
||||||
time.sleep(self.eatingTime)
|
time.sleep(self.eatingTime)
|
||||||
@ -37,6 +38,13 @@ class Kitchen(object):
|
|||||||
time.sleep(plate.preparationTime) #kuchnia przygotowuje danie przez określony czas
|
time.sleep(plate.preparationTime) #kuchnia przygotowuje danie przez określony czas
|
||||||
self.readyDishes.put(plate)
|
self.readyDishes.put(plate)
|
||||||
|
|
||||||
|
def giveDish(self):
|
||||||
|
if not self.readyDishes.empty():
|
||||||
|
plate = self.readyDishes.get()
|
||||||
|
return plate
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class Client(object):
|
class Client(object):
|
||||||
def __init__(self, age, sex, budget):
|
def __init__(self, age, sex, budget):
|
||||||
@ -148,6 +156,18 @@ class Waiter(object):
|
|||||||
def resetPosition(self, pos):
|
def resetPosition(self, pos):
|
||||||
self.pos = pos
|
self.pos = pos
|
||||||
|
|
||||||
|
def takePlates(self, kitchen):
|
||||||
|
for i in range(2):
|
||||||
|
plate = kitchen.giveDish()
|
||||||
|
if plate == None:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self.plates.append(plate)
|
||||||
|
|
||||||
|
def giveClientPlate(self, client):
|
||||||
|
plate = self.plates.pop(0)
|
||||||
|
client.takePlateAndEat(plate)
|
||||||
|
|
||||||
def draw(self, surface):
|
def draw(self, surface):
|
||||||
i = self.pos[0]
|
i = self.pos[0]
|
||||||
j = self.pos[1]
|
j = self.pos[1]
|
||||||
|
Loading…
Reference in New Issue
Block a user