summaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
authorAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-30 08:28:14 +0200
committerAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-30 08:28:14 +0200
commitdb3fd859e42fb3d6b3c1f98473b54e91d78b74e7 (patch)
tree5d08001a2dcd6e3ddaf1f9118c9ae345d4ab7132 /app.py
parentfa6a80ea7107c3a1e7c1fa600817b0c5f7be5d36 (diff)
Making it actually possible to select board dimensions.
Diffstat (limited to 'app.py')
-rw-r--r--app.py19
1 files changed, 13 insertions, 6 deletions
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)