#!/usr/bin/python import gtp import ishi import goban def main(): boardsize = 19 player = [0,0] komi = 6.5 handicap = 0 player[ishi.black] = \ gtp.gtp("gnugo --mode gtp", boardsize, komi, handicap) player[ishi.white] = \ gtp.gtp("gnugo --mode gtp", boardsize, komi, handicap) board = goban.board(boardsize) print board print passcount = 0 while 1: for state in [ishi.black,ishi.white]: move = player[state].get_input(state) print 'got move',move,'from',ishi.description(state) if move == 'PASS': passcount += 1 else: passcount = 0 player[ishi.invert(state)].feed_move(state,move) if move != 'PASS': board.move(move,state) print board print if passcount == 2: break if passcount == 2: break for state in [ishi.black,ishi.white]: print ishi.description(state),'estimates',\ player[state].get_result() main()