diff options
author | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-14 14:56:54 +0200 |
---|---|---|
committer | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-14 14:56:54 +0200 |
commit | 3dd13c9ed2fc57c525ddf0dd5c7d130229087a16 (patch) | |
tree | 3b3254fabd14253977cadf1fc4c4d736b311b92c /tui/tui.py | |
parent | 2b98f7c66facfe71bf91aebc0d8cf3978e88303f (diff) |
Making bomb and safe marking to actually do something.
Diffstat (limited to 'tui/tui.py')
-rw-r--r-- | tui/tui.py | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -47,7 +47,8 @@ class Tui(): # pylint: disable=consider-using-enumerate for y in range(len(matrix[0])): for x in range(len(matrix)): - self.draw_tile(matrix[x][y], x == hx and y == hy) + hilight = matrix[x][y] != 9 and x == hx and y == hy + self.draw_tile(matrix[x][y], hilight) print() @@ -74,7 +75,7 @@ class Tui(): match action: case Action.QUIT: return (action, x, y) - case Action.OPEN | Action.FLAG: + case Action.OPEN | Action.FLAG | Action.BOMB | Action.SAFE: if matrix[x][y] >= 10: return (action, x, y) case Action.UP: @@ -85,6 +86,14 @@ class Tui(): y = y+1 if y < len(matrix[0])-1 else y case Action.RIGHT: x = x+1 if x < len(matrix)-1 else x + case Action.TOP: + y = 0 + case Action.BOTTOM: + y = len(matrix[0])-1 + case Action.BEGIN: + x = 0 + case Action.END: + x = len(matrix)-1 self.draw_matrix(matrix, x, y) |