summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-02-17 09:41:48 +0200
committerAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-02-17 09:41:48 +0200
commite785dbd4f726c5716f21071ed25dc35ac87c0c74 (patch)
tree781373b78380a1ffd1ea8c5dc8ceb2bd313631e9 /game
parent4eff4a32cfa594cc2a3df3885de92d407edc6675 (diff)
Dev tools and directory structure rework.
Diffstat (limited to 'game')
-rw-r--r--game/__init__.py2
-rw-r--r--game/game.py41
2 files changed, 0 insertions, 43 deletions
diff --git a/game/__init__.py b/game/__init__.py
deleted file mode 100644
index 066e2e3..0000000
--- a/game/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-""" game - pelin kulkuun liittyvä logiikka """
-from .game import Game
diff --git a/game/game.py b/game/game.py
deleted file mode 100644
index fefcf8f..0000000
--- a/game/game.py
+++ /dev/null
@@ -1,41 +0,0 @@
-""" game/game.py - pelin etenemiseen liittyvä ohjaus """
-from tui import Action
-
-class Game:
- """ Game - peli """
- def __init__(self, board, ui):
- self.board = board
- self.ui = ui
- self.x, self.y = board.get_width()//2, board.get_height()//2
-
-
- def __del__(self):
- self.board.reveal()
- self.ui.game_end(self.board.get_view())
-
-
- def next(self):
- """ seuraava kiitos vai jotain muuta? """
- action, self.x, self.y = self.ui.matrix_selector(
- self.board.get_view(), self.x, self.y
- )
- match action:
- case Action.QUIT:
- return False
- case Action.OPEN:
- if self.board.get_mask(self.x, self.y):
- if not self.board.guess(self.x, self.y):
- self.ui.game_over(
- self.board.get_view(), self.x, self.y
- )
- return False
- if self.board.is_winning():
- self.ui.game_win(self.board.get_view(), self.x, self.y)
- return False
- case Action.FLAG:
- self.board.flag(self.x, self.y)
- case Action.MINE:
- self.board.flag(self.x, self.y, 10)
- case Action.SAFE:
- self.board.flag(self.x, self.y, 11)
- return True