Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés Ambrois <andresambrois@gmail.com>2008-08-16 11:20:06 (GMT)
committer Andrés Ambrois <andresambrois@gmail.com>2008-08-16 11:20:06 (GMT)
commit2a09b6f71f92ac8ccd792877f93c603594ef6b92 (patch)
tree44c1233b9ef07dca180f3e563e51cf3b148a5802
parent6200c1437f278640f4c94f6ccfc9aeaeedf0e7ba (diff)
gtp.py: Delegate color handling to the caller
-rw-r--r--gtp.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/gtp.py b/gtp.py
index 98a500a..22bc442 100644
--- a/gtp.py
+++ b/gtp.py
@@ -34,9 +34,8 @@ def search_for_gnugo():
class gnugo:
''' A wrapper for talking to gnugo over GTP '''
- def __init__(self, boardsize=19, color='black', handicap=0, komi=5.5, level=3):
+ def __init__(self, boardsize=19, handicap=0, komi=5.5, level=3):
''' Start the gnugo subprocess '''
- self.color = color
try:
self.gnugo = Popen(['gnugo', '--mode', 'gtp', '--boardsize', str(boardsize),
'--handicap', str(handicap), '--komi', str(komi), '--level', str(level) ],
@@ -57,8 +56,8 @@ class gnugo:
def _coords_to_xy(self, coords):
return int(dict(zip('ABCDEFGHIJKLMNOPQRSTUVWXYZ', range(0, 26)))[coords[0]]), int(coords[1:])
- def make_play(self, x, y):
- self.stdin.write('play %s %s\n' % (self.color, self._xy_to_coords(x, y)))
+ def make_play(self, color, x, y):
+ self.stdin.write('play %s %s\n' % (color, self._xy_to_coords(x, y)))
self.stdin.flush()
output = self.stdout.readline()
self.stdout.readline()