summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2021-02-13 14:53:19 +0100
committerOlivier Gayot <olivier.gayot@sigexec.com>2021-02-13 14:53:19 +0100
commitaae1ac7872ceb93058d51ae7640b2ebf994c7856 (patch)
treebcb6a4afd762f1e5b834158cd08a61d05208831d
parent89c3dc6b99f32ee0eacdf34d179dff797ad90c4a (diff)
Implement the top out
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rwxr-xr-xcameltris.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/cameltris.py b/cameltris.py
index 6d33718..cf29a72 100755
--- a/cameltris.py
+++ b/cameltris.py
@@ -208,6 +208,9 @@ class Player:
return len(rows_to_burn)
def lock_piece(self):
+ if self.has_collision(self.current_piece_position[0], self.current_piece_position[1]):
+ raise WouldCollide()
+
for row_id, row in enumerate(self.current_piece.elements):
for col_id, element in enumerate(row):
if element is None: