-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
32 lines (31 loc) · 883 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 pygame
from GUI import Drawer
from Play import Play
from Game import Game
import time
draw = Drawer()
# Run the game loop
running = True
test = Play()
game = Game(1)
player = 1
while (not game.gameOver()):
if (player == 1):
draw.DisplayPossibleMoves(game.state.possibleMoves(1))
player = test.humanTurn(game)
draw.RemovePossibleMoves(game.state.possibleMoves(1))
draw.Update1(game.state.board)
draw.DisplayTurn(player)
else:
player, game = test.computerTurn(game, test)
draw.Update2(game.state.board)
draw.DisplayTurn(player)
# Handle events
for event in pygame.event.get():
# Quit the game if the user closes the window
if event.type == pygame.QUIT:
running = False
player, score = game.findWinner()
draw.DisplayTheWinner(player, score)
time.sleep(10)
pygame.quit()