From e591d15abc4943a74c39f0fcab065213828a1514 Mon Sep 17 00:00:00 2001 From: Aineopintojen-harjoitustyo-Algoritmit-j Date: Mon, 29 Jan 2024 02:34:32 +0200 Subject: Updating too much. Renewed bots and tui. --- app.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'app.py') diff --git a/app.py b/app.py index a38c897..8ca19ab 100644 --- a/app.py +++ b/app.py @@ -1,26 +1,40 @@ """ app.py - pääohjelma """ -from board import Board, Level -from tui import Tui, AutoTui +from board import Board, Level, LevelSpecs +from tui import Tui from game import Game -from bots import BadBot +from bots import SimpleBot, DSSPBot # pylint: disable = too-few-public-methods class App: """ App - Luokka pääohjelmalle""" def __init__(self, args=None): level = Level.BEGINNER - ui_class = Tui - uncertain = False + auto, uncertain, quiet = False, False, False if args: level = Level.EXPERT if args.expert else level level = Level.INTERMEDIATE if args.intermediate else level level = Level.BEGINNER if args.beginner else level - ui_class = AutoTui if args.auto else ui_class - uncertain = args.uncertain + width, height, bombs = LevelSpecs[level] + auto = args.auto + auto, uncertain = (True, True) if args.uncertain else (auto, False) + auto, uncertain, quiet = (True, True, True) \ + if args.quiet else (auto, uncertain, False) + self.bot = SimpleBot(uncertain=uncertain) if args.simple \ + else DSSPBot(uncertain=uncertain) + self.ui = Tui ( + bot=self.bot, + autoplay=auto, + interact=not uncertain, + suppress=quiet, + width=width, + height=height, + bombs=bombs + ) self.board = Board(level=level) - self.bot = BadBot(uncertain=uncertain) - self.ui = ui_class(self.bot) + self.bot = DSSPBot(uncertain=uncertain) if self.bot is None \ + else self.bot + self.ui = Tui(bot=self.bot) if self.ui is None else self.ui self.game = Game(self.board,self.ui) def run(self): -- cgit v1.2.3