Got it to end if the enter (return) key is used.

This commit is contained in:
Cory 2024-05-18 21:07:36 -04:00
parent 3334db0c8b
commit cb8b28b68c
2 changed files with 5 additions and 4 deletions

Binary file not shown.

View File

@ -8,7 +8,8 @@ class Mine:
def __init__(self, position):
self.position = position
def play_turn(self, game):
if not game.is_empty(self.position):
game.log("You hit a mine at " + str(self.position) + ".")
game.end()
def handle_keystroke(self, keystroke, game):
if keystroke.name in ("KEY_ENTER"):
if not game.is_empty(self.position):
game.log("You hit a mine at " + str(self.position) + ".")
game.end()