def brain_restart(): board.reset() pp.pipeOut("OK")
def brain_opponents(x, y): if isFree(x, y): board[x][y] = 2 else: pp.pipeOut("ERROR opponents's move [{},{}]".format(x, y))
def brain_restart(): ai.start(pp.width, pp.height) pp.pipeOut("OK")
def brain_opponents(x, y): if gomoku.is_free(x, y): gomoku.make_move(x, y, 2) else: pp.pipeOut("ERROR opponents's move [{},{}]".format(x, y))
def brain_restart(): for x in range(pp.width): for y in range(pp.height): board[x][y] = 0 pp.pipeOut("OK")
def brain_block(x, y): if isFree(x, y): board.move(x, y, board.get_next_player()) else: pp.pipeOut("ERROR winning move [{},{}]".format(x, y))
def brain_restart(): gomoku.restart() pp.pipeOut("OK")
def brain_about(): logDebug('brain_about()') pp.pipeOut(pp.infotext)
def brain_restart(): """delete old board, create new board, call pipeOut("OK")""" for x in range(pp.width): for y in range(pp.height): board[x][y] = 0 pp.pipeOut("OK")
def brain_my(x, y): logDebug('my_move({},{})'.format(x, y)) if isFree(x, y): board[x][y] = 1 else: pp.pipeOut("ERROR my move [{},{}]".format(x, y))
def brain_opponents(x, y): logDebug('opponent_move({},{})'.format(x, y)) if isFree(x, y): board[x][y] = 2 else: pp.pipeOut("ERROR opponents's move [{},{}]".format(x, y))
def brain_about(): pp.pipeOut('f**k')
def brain_block(x, y): if isFree(x, y): board[x][y] = 3 logDebug('brain_block at (%s, %s)' % (x, y)) else: pp.pipeOut("ERROR winning move [{},{}]".format(x, y))
def brain_opponents(x, y): # 这个函数在对手胜利的那步不会被调用 if isFree(x, y): main.run_opponent(x, y) else: pp.pipeOut("ERROR opponents's move [{},{}]".format(x, y))
def brain_my(x, y): if isFree(x, y): board.move(x, y, board.get_next_player()) else: pp.pipeOut("ERROR my move [{},{}]".format(x, y))
def brain_my(x, y): """put your move to the board""" if isFree(x, y): board[x][y] = 1 else: pp.pipeOut("ERROR my move [{},{}]".format(x, y))
def brain_opponents(x, y): if isFree(x, y): board.move(x, y, board.get_next_player()) else: pp.pipeOut("ERROR opponents's move [{},{}]".format(x, y))
def brain_opponents(x, y): """put opponent's move to the board""" if isFree(x, y): board[x][y] = 2 else: pp.pipeOut("ERROR opponents's move [{},{}]".format(x, y))
def brain_about(): """ Print copyright. """ pp.pipeOut(pp.infotext)
def brain_block(x, y): """square [x,y] belongs to a winning line (when info_continuous is 1)""" if isFree(x, y): board[x][y] = 3 else: pp.pipeOut("ERROR winning move [{},{}]".format(x, y))
def brain_my(x, y): if gomoku.is_free(x, y): gomoku.make_move(x, y, 1) else: pp.pipeOut("ERROR my move [{},{}]".format(x, y))
def brain_restart(): board.reset() uct.reset() global START_TIME START_TIME = time.time() pp.pipeOut("OK")
def brain_block(x, y): if gomoku.is_free(x, y): gomoku.make_move(x, y, 3) else: pp.pipeOut("ERROR winning move [{},{}]".format(x, y))
def brain_opponents(x, y): if isFree(x, y): board[x][y] = 2 uct.forward(action=((x, y), 2)) else: pp.pipeOut("ERROR opponents's move [{},{}]".format(x, y))
def brain_my(x, y): if isFree(x, y): board[x][y] = 1 else: pp.pipeOut("ERROR my move [{},{}]".format(x, y))
def main(): pp.pipeOut("OK") pp.main()
def brain_block(x, y): if isFree(x, y): board[x][y] = 3 else: pp.pipeOut("ERROR winning move [{},{}]".format(x, y))
def brain_restart(): global board, COMPUTER board = Board() COMPUTER = Computer() pp.pipeOut("OK")
def brain_about(): pp.pipeOut(pp.infotext)
def brain_restart(): logDebug('brain restart') gomoku.restart() pp.pipeOut("OK")