forked from yl573/BetaGo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
go_example.py
39 lines (31 loc) · 811 Bytes
/
go_example.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
from GoGame.GoSimulator import GoSimulator
from Shared.Consts import BLACK, WHITE
import numpy as np
game = GoSimulator(5)
boards = np.array([[
[0,0,0,0,0],
[0,0,1,0,0],
[0,1,-1,1,0],
[0,-1,0,-1,0],
[0,0,-1,0,0]
],[
[0,0,0,0,0],
[0,0,1,0,0],
[0,1,0,1,0],
[0,-1,1,-1,0],
[0,0,-1,0,0]
]])
game.set_board_from_prev_boards(boards, WHITE)
# or if there is no KO, you can use
# game.set_board(boards[-1], BLACK)
print(game.board)
# this function is currently faulty, it doesn't deal with ko
# but for the go player it makes no difference
legal = game.get_legal_moves()
print(legal, '\n')
board, next_player = game.play(2,2)
print(board, next_player, '\n')
black_lead = game.black_score_lead()
print(black_lead)
#white_lead = game.white_score_lead()
#print (white_lead)