TLDR
MCTS代理程序的实现在本地运行时没有错误,相对于启发式驱动的minimax,成功率达到了40%以上,但自动分级器却没有通过-这是提交项目之前的要求。自动平地机抛出
IndexError: Cannot choose from an empty sequence。我正在寻找最有可能引发此异常的代码方面的建议。
嗨,我目前停留在这个项目上,我需要在2个星期的时间内完成该项目,然后才能完成所注册的程序的清理。我已经完成的任务是在两个国际象棋骑士之间的隔离游戏中实现一个代理,以与启发式驱动的minimax代理进行对抗。完整的游戏实施细节可以在这里找到。对于我的项目,将使用位板编码在9 x 11的板上玩游戏。我的MCTS实现非常简单,紧随本文(第6页)提供的伪代码。
本质上,一般的MCTS方法包括这4个部分,它们分别由CustomPlayer类中的以下嵌套函数实现:
反向传播-backup_negamax,update_scores
import math
import random
import time
import logging
from copy import deepcopy
from collections import namedtuple
from sample_players import DataPlayer
class CustomPlayer(DataPlayer):
""" Implement your own agent to play knight's Isolation
The get_action() method is the only required method for this project.
You can modify the interface for get_action by adding named parameters
with default values, but the …Run Code Online (Sandbox Code Playgroud)python artificial-intelligence python-3.x monte-carlo-tree-search