-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
51 lines (34 loc) · 986 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import copy
import random
from board import Board
from player import Player
from game import Game
w_player = Player(Board.WHITE)
b_player = Player(Board.BLACK)
player = (w_player, b_player)
def StartGame():
b = Board(4)
player_index = 0
moves = 0
outcome = (False, 0)
while outcome[0] == False:
player_index = moves % 2
cur_player = player[player_index]
color_txt = Board.Color2Text[cur_player.color]
print("{} to move!".format(color_txt))
print(b)
print("---")
# Get the point that the current player is going to play
pt = cur_player.PlayMove(b)
# Color the current point
b.ColorPoint(pt, cur_player.color)
print("{} plays {}!".format(color_txt, pt))
print(b)
print(">>>")
moves += 1
outcome = b.DetectGameEnd()
print("{} wins!".format(Board.Color2Text[outcome[1]]))
return
# StartGame()
game = Game(11)
game.Start()