def brain_init(): if pp.width < 5 or pp.height < 5: pp.pipeOut("ERROR size of the board") return if pp.width > MAX_BOARD or pp.height > MAX_BOARD: pp.pipeOut("ERROR Maximal board size is {}".format(MAX_BOARD)) return gomoku = util.Gomoku(pp.height, pp.width) pp.pipeOut("OK")
def brain_init(): logDebug('brain init') if pp.width < 5 or pp.height < 5: pp.pipeOut("ERROR size of the board") return if pp.width > MAX_BOARD or pp.height > MAX_BOARD: pp.pipeOut("ERROR Maximal board size is {}".format(MAX_BOARD)) return gomoku = util.Gomoku(pp.height, pp.width) logDebug(str(gomoku.get_board())) pp.pipeOut("OK")
import random import gomoku_util as util import pisqpipe as pp from pisqpipe import DEBUG_EVAL, DEBUG pp.infotext = 'name="fighting_random", author="Ding", version="0.0", country="China", www="https://github.com/stranskyjan/pbrain-pyrandom"' MAX_BOARD = 20 gomoku = util.Gomoku(MAX_BOARD, MAX_BOARD) def brain_init(): if pp.width < 5 or pp.height < 5: pp.pipeOut("ERROR size of the board") return if pp.width > MAX_BOARD or pp.height > MAX_BOARD: pp.pipeOut("ERROR Maximal board size is {}".format(MAX_BOARD)) return gomoku = util.Gomoku(pp.height, pp.width) pp.pipeOut("OK") def brain_restart(): gomoku.restart() pp.pipeOut("OK") 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))