-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGo0.py
More file actions
executable file
·41 lines (32 loc) · 997 Bytes
/
Go0.py
File metadata and controls
executable file
·41 lines (32 loc) · 997 Bytes
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
#!/usr/local/bin/python3
# /usr/bin/python3
# Set the path to your python3 above
from gtp_connection import GtpConnection
from board_util import GoBoardUtil
from board import GoBoard
class Go0:
def __init__(self):
"""
Go player that selects moves randomly from the set of legal moves.
Does not use the fill-eye filter.
Passes only if there is no other legal move.
Parameters
----------
name : str
name of the player (used by the GTP interface).
version : float
version number (used by the GTP interface).
"""
self.name = "Go0"
self.version = 1.0
def get_move(self, board, color):
return GoBoardUtil.generate_random_move(board, color, use_eye_filter=False)
def run():
"""
start the gtp connection and wait for commands.
"""
board = GoBoard(7)
con = GtpConnection(Go0(), board)
con.start_connection()
if __name__ == "__main__":
run()