From db3fd859e42fb3d6b3c1f98473b54e91d78b74e7 Mon Sep 17 00:00:00 2001 From: Aineopintojen-harjoitustyo-Algoritmit-j Date: Tue, 30 Jan 2024 08:28:14 +0200 Subject: Making it actually possible to select board dimensions. --- app.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'app.py') diff --git a/app.py b/app.py index 4af66dd..a9cee19 100644 --- a/app.py +++ b/app.py @@ -8,20 +8,27 @@ from bots import SimpleBot, DSSPBot class App: """ App - Luokka pääohjelmalle""" def __init__(self, args=None): - level = Level.BEGINNER + board_opts = {'level': Level.BEGINNER} tui_opts = {'bot': DSSPBot} if args: - # pylint: disable = pointless-statement - (level:=Level.INTERMEDIATE) if args.intermediate else () - (level:=Level.EXPERT) if args.expert else () + if args.intermediate: + board_opts['level'] = Level.INTERMEDIATE + if args.expert: + board_opts['level'] = Level.EXPERT + if args.w: + board_opts['width'] = args.w + if args.H: + board_opts['height'] = args.H + if args.b: + board_opts['bombs'] = args.b tui_opts['bot'] = SimpleBot if args.simple else DSSPBot tui_opts['autoplay'] = args.auto tui_opts['interactive'] = not args.uncertain tui_opts['suppress'] = args.quiet - tui_opts['height'] = LevelSpecs[level][1] + tui_opts['height'] = LevelSpecs[board_opts['level']][1] - self.board = Board(level=level) + self.board = Board(**board_opts) self.ui = Tui(**tui_opts) self.game = Game(self.board,self.ui) -- cgit v1.2.3