def experimentGenerator(): """returns random board with 2 pieces already on it""" board = GameBoard() x, y = choice(board.possibleMoves()) board.addMove(GameBoard.O, x, y) x, y = choice(board.possibleMoves()) board.addMove(GameBoard.X, x, y) return board
def performanceSystem(first_strategy, board=None, second_strategy=DEFAULT_STRATEGY): if not board: board = GameBoard() i = len(board.trace) while not board.gameEnded(): player, strategy = GameBoard.X, second_strategy if i % 2: player, strategy = GameBoard.O, first_strategy x, y = board.chooseMove(strategy, player) board.addMove(player, x, y) i += 1