-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (44 loc) · 1.28 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import pygame
from game import Game
# Initialize pygame
pygame.init()
# Constants
EMPTY = 0
VALID = 1
BLACK_PIECE = 2
WHITE_PIECE = 3
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
LIGHT = (240, 240, 210)
DARK = (120, 160, 80)
CELL_SIZE = 40
pygame.display.set_caption('Boku')
clock = pygame.time.Clock()
alt_board_structure = [
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 1],
[0, 0, 0, 1, 1, 1, 1, 1, 1, 1],
[0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
]
ROWS = len(alt_board_structure)
COLS = len(alt_board_structure[0])
WIDTH = CELL_SIZE*COLS
HEIGHT = CELL_SIZE*ROWS
screen = pygame.display.set_mode((WIDTH, HEIGHT))
font = pygame.font.SysFont(None, 24)
if __name__ == "__main__":
game = Game()
ai_question = input("Do you want to play against the AI? (y/n)\n")
if ai_question == "y":
player_nr = int(input("Which player do you want to be? (1 or 2)\n"
"1 will start the game, 2 will go second\n"))
ai_player = 1 if player_nr== 2 else 2
game.turn_on_ai(player_nr)
game.run()