Example #1
0
 def __init__(self,infile,outfile,debugfile):
     """
     infile is the file from which the GTP should read input (usually 
     sys.stdin).
     outfile is the file to which GTP shold write output (usually
     sys.stdout).
     debugfile is the file to which GTP should write out Debugging info,
     unless DEBUG = 0.
     
     This class relies on the symbol DEBUG, set to a true value for debugging
     information, and a false one to omit it.
     """
     self.infile = infile
     self.outfile = outfile
     self.debugfile = debugfile
     self.version = 2
     self.game = go_game(debugfile)
     self.functions = \
     [("boardsize", self.set_boardsize), \
     ("protocol_version", self.protocol_version), \
     ("clear_board", self.clear_board), \
     ("komi", self.komi), \
     ("fixed_handicap", self.fixed_handicap), \
     ("play", self.play), \
     ("genmove", self.genmove), \
     ("final_score", self.final_score), \
     ("name", self.name), \
     ("version", self.get_version), \
     ("known_command", self.known_command), \
     ("list_commands", self.list_commands), \
     ("fixed_handicap", self.fixed_handicap), \
     ("quit", None)]
Example #2
0
 def __init__(self, infile, outfile, debugfile):
     """
     infile is the file from which the GTP should read input (usually 
     sys.stdin).
     outfile is the file to which GTP shold write output (usually
     sys.stdout).
     debugfile is the file to which GTP should write out Debugging info,
     unless DEBUG = 0.
     
     This class relies on the symbol DEBUG, set to a true value for debugging
     information, and a false one to omit it.
     """
     self.infile = infile
     self.outfile = outfile
     self.debugfile = debugfile
     self.version = 2
     self.game = go_game(debugfile)
     self.functions = \
     [("boardsize", self.set_boardsize), \
     ("protocol_version", self.protocol_version), \
     ("clear_board", self.clear_board), \
     ("komi", self.komi), \
     ("fixed_handicap", self.fixed_handicap), \
     ("play", self.play), \
     ("genmove", self.genmove), \
     ("final_score", self.final_score), \
     ("name", self.name), \
     ("version", self.get_version), \
     ("known_command", self.known_command), \
     ("list_commands", self.list_commands), \
     ("fixed_handicap", self.fixed_handicap), \
     ("quit", None)]
Example #3
0
 def setUp(self):
     self.boardsize = 19
     self.g = go_game.go_game(self, sys.stdin)
     self.g.set_boardsize(self.boardsize)
     self.g.clear_board()
     self.g.set_komi("5.5")
     #test handicaps?
     
     self.testBoard = []
     for i in range(self.boardsize):
         self.testBoard.append([])
         for j in range(self.boardsize):
             self.testBoard[i].append(' ')