From aae1ac7872ceb93058d51ae7640b2ebf994c7856 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sat, 13 Feb 2021 14:53:19 +0100 Subject: Implement the top out Signed-off-by: Olivier Gayot --- cameltris.py | 3 +++ 1 file changed, 3 insertions(+) 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: -- cgit v1.2.3