summaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
Diffstat (limited to 'app.py')
-rw-r--r--app.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/app.py b/app.py
deleted file mode 100644
index 8553fe5..0000000
--- a/app.py
+++ /dev/null
@@ -1,42 +0,0 @@
-""" app.py - pääohjelma """
-from board import Board, Level
-from tui import Tui
-from game import Game
-from bots import SimpleBot, DSSPBot
-
-# pylint: disable = too-few-public-methods
-class App:
- """ App - Luokka pääohjelmalle"""
- def __init__(self, args=None):
- board_opts = {'level': Level.BEGINNER}
- tui_opts = {'bot': DSSPBot}
- if args:
- # pylint: disable = multiple-statements
- if args.intermediate: board_opts['level'] = Level.INTERMEDIATE
- if args.expert: board_opts['level'] = Level.EXPERT
- if args.board:
- board_opts['board'] = args.board
- else:
- if args.mines: board_opts['mines'] = args.mines
- if args.size:
- board_opts['width'] = args.size[0]
- board_opts['height'] = args.size[1]
-
- if args.bot==0: tui_opts['bot'] = None
- if args.bot==1: tui_opts['bot'] = SimpleBot
- tui_opts['autoplay'] = args.autoplay > 0
- tui_opts['interactive'] = args.autoplay != 2
- tui_opts['suppress'] = args.quiet
- tui_opts['delay'] = args.delay
-
- self.board = Board(**board_opts)
- tui_opts['level_name'] = self.board.get_level_name()
- tui_opts['height'] = self.board.get_height()
- self.ui = Tui(**tui_opts)
- self.game = Game(self.board,self.ui)
-
- def run(self):
- """ käynnistää pelin """
- while self.game.next():
- pass
- return self.board.is_winning()