-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
32 lines (26 loc) · 946 Bytes
/
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
import argparse
import pygame
parser = argparse.ArgumentParser(description="Gooo game")
parser.add_argument(
"-n", "--board_size", metavar="board_size", type=int, nargs="?", default=5,
help="size of the board"
)
parser.add_argument(
"-a", "--autoplay", metavar="autoplay", type=bool, nargs="?", const=True, default=False,
help="is second player a bot?"
)
parser.add_argument(
"-s", "--suggestions", metavar="suggestions", type=bool, nargs="?", const=True, default=False,
help="show suggestions"
)
args = parser.parse_args()
size = args.board_size
autoplay = args.autoplay
suggestions = args.suggestions
if __name__ == "__main__":
assert 1 < size <= 10, "invalid size: {size}; the size should be in the interval [2, 10]".format(size=size)
from game import Game
pygame.init()
pygame.display.set_caption("Gooo")
game = Game(size, autoplay=(False, autoplay), suggestions=suggestions)
game.play()