-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNogo.py
32 lines (26 loc) · 787 Bytes
/
Nogo.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
#/usr/local/bin/python
#!/usr/bin/python
# Set the path to your python3 above
from gtp_connection import GtpConnection
from board_util import GoBoardUtil
from simple_board import SimpleGoBoard
class Nogo():
def __init__(self):
"""
NoGo player that selects moves randomly
from the set of legal moves.
Passe/resigns only at the end of game.
"""
self.name = "NoGoAssignment2"
self.version = 1.0
def get_move(self, board, color):
return GoBoardUtil.generate_random_move(board, color, False)
def run():
"""
start the gtp connection and wait for commands.
"""
board = SimpleGoBoard(7)
con = GtpConnection(Nogo(), board)
con.start_connection()
if __name__=='__main__':
run()