Skip to content
Snippets Groups Projects
Commit 54154a3a authored by Florian Schröder's avatar Florian Schröder
Browse files

only combine items on the sink addon

parent 340b1d8b
No related branches found
No related tags found
1 merge request!20Resolve "Plate washing cycle"
Pipeline #42401 passed
......@@ -362,7 +362,7 @@ class SinkAddon(Counter):
self.occupied_by = deque(occupied_by) if occupied_by else deque()
def can_drop_off(self, item: Item) -> bool:
return not self.occupied_by or self.occupied_by[-1].can_combine(item)
return self.occupied_by and self.occupied_by[-1].can_combine(item)
def drop_off(self, item: Item) -> Item | None:
"""Takes the thing dropped of by the player.
......@@ -370,14 +370,10 @@ class SinkAddon(Counter):
Args:
item: The item to be placed on the counter.
Returns: TODO Return information, whether the score is affected (Serving Window?)
Returns:
"""
if not self.occupied_by:
self.occupied_by.append(item)
elif self.occupied_by[-1].can_combine(item):
return self.occupied_by[-1].combine(item)
return None
return self.occupied_by[-1].combine(item)
def add_clean_plate(self, plate: Plate):
self.occupied_by.appendleft(plate)
......
......@@ -4,8 +4,8 @@ _#_______M_______
_#_______#_______
_W_______________
_#__A__A_________
_B_______________
_B_______#_______
_C_______________
_C_______#_______
_#_______X_______
_#P#S+#S+#_______
_________________
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment