コード例 #1
0
def main():
    game = GameState.new_game(BOARD_SIZE)
    bot = DepthPrunedAgent(2, capture_diff)

    while not game.is_over():
        print_board(game.board)
        if game.next_player == Player.BLACK:
            human_move = input("-- ")
            point = point_from_coordinate(human_move.strip())
            move = Move.play(point)
        else:
            move = bot.select_move(game)
        print_move(game.next_player, move)
        game = game.apply_move(move)
コード例 #2
0
def main():
    board_size = 9
    game = GameState.new_game(board_size)
    bots = {
        Player.BLACK: agent.naive.RandomBot(),
        Player.WHITE: agent.naive.RandomBot(),
    }

    while not game.is_over():
        time.sleep(0.3)
        print(chr(27) + "[2J")
        print_board(game.board)
        bot_move = bots[game.next_player].select_move(game)
        print_move(game.next_player, bot_move)
        game = game.apply_move(bot_move)