diff options
author | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-13 21:27:35 +0200 |
---|---|---|
committer | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-13 21:27:35 +0200 |
commit | 9087617e2e023010f5386f222303292dbd015996 (patch) | |
tree | e2cc28640ec227350d6a11e1fa85e2b6de274fd2 /board | |
parent | b12c97653c2ee004292b0fdfd770a2c59451854b (diff) |
Adding tests for rest of board/board.py and removing duplicate code.
Diffstat (limited to 'board')
-rw-r--r-- | board/board.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/board/board.py b/board/board.py index 069b568..22885c7 100644 --- a/board/board.py +++ b/board/board.py @@ -93,8 +93,12 @@ class Board(): """ tarkistaa onko peli voitettu """ for y in range(self.size): for x in range(self.size): - if self.tiles[x][y] != 9 and self.masked[x][y]: - return False + if self.tiles[x][y] == 9: + if not self.masked[x][y]: + return False + else: + if self.masked[x][y]: + return False return True @@ -123,10 +127,6 @@ class Board(): print("Koordinaatit on pelilaudan ulkopuolella", file=stderr) return False - if self.masked[x][y] == 0: - print("Ei voi liputtaa avattua ruutua", file=stderr) - return False - match self.masked[x][y]: case 0: print("Ei voi liputtaa avattua ruutua", file=stderr) |