-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
33 lines (32 loc) · 1.03 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from ui import UI
from board import Board
import sys
# Beginner 9-9-10, Intermediate 16-16-40, Expert 16-30-99
if __name__ == "__main__":
board_size = 16, 16
bombs = 40
if len(sys.argv) == 4:
try:
board_size = int(sys.argv[1]), int(sys.argv[2])
bombs = int(sys.argv[3])
except:
print("Invalid input, default to Intermediate")
elif len(sys.argv) == 2:
if sys.argv[1] == "beginner":
board_size = 9, 9
bombs = 10
elif sys.argv[1] == "intermediate":
board_size = 16, 16
bombs = 40
elif sys.argv[1] == "expert":
board_size = 16, 30
bombs = 99
else:
print("Invalid input, default to Intermediate")
piece_size = 25, 25
if board_size[0] > 32 or board_size[1] > 32:
new_piece_size = max([800 // board_size[0], 800 // board_size[1]])
piece_size = new_piece_size, new_piece_size
board = Board(board_size, bombs)
ui = UI(board, piece_size)
ui.run()