-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcounter.py
109 lines (83 loc) · 2.75 KB
/
counter.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
from ingredients import *
class Counter:
def __init__(self, name, location):
self.name = name
self.type = ''
self.contains = None
self.location = location
def __str__(self):
return f"{self.name} at {self.location} containing {self.contains}"
def add(self, obj):
self.contains = obj
def remove(self):
obj = self.contains
self.contains = None
return obj
def action(self):
pass
class PlainCounter(Counter):
def __init__(self, location):
super().__init__('PlainCounter', location)
self.type = 'none'
self.contains = None
class IngredientCounter(Counter):
def __init__(self, name, location):
super().__init__(name, location)
self.type = 'supply'
def add(self, obj):
pass
def remove(self):
return self.contains
class PorkCounter(IngredientCounter):
def __init__(self, location):
super().__init__('PorkCounter', location)
self.contains = Pork(self.location)
def remove(self):
return Pork(self.location)
class CheeseCounter(IngredientCounter):
def __init__(self, location):
super().__init__('CheeseCounter', location)
self.contains = Cheese(self.location)
def remove(self):
return Cheese(self.location)
class LettuceCounter(IngredientCounter):
def __init__(self, location):
super().__init__('LettuceCounter', location)
self.contains = Lettuce(self.location)
def remove(self):
return Lettuce(self.location)
class TomatoCounter(IngredientCounter):
def __init__(self, location):
super().__init__('TomatoCounter', location)
self.contains = Tomato(self.location)
def remove(self):
return Tomato(self.location)
class BreadCounter(IngredientCounter):
def __init__(self, location):
super().__init__('BreadCounter', location)
self.contains = Bread(self.location)
def remove(self):
return Bread(self.location)
class ActionCounter(Counter):
def __init__(self, name, location):
super().__init__(name, location)
self.type = 'action'
class Pan(ActionCounter):
def __init__(self, location):
super().__init__('Pan', location)
def action(self):
if self.contains:
self.contains.grill()
class Cutboard(ActionCounter):
def __init__(self, location):
super().__init__('Cutboard', location)
def action(self):
if self.contains:
self.contains.chop()
class DeliverCounter(Counter):
def __init__(self, location):
super().__init__('DeliverCounter', location)
self.type = 'action'
self.contains = []
def add(self, obj):
self.contains.append(obj)