Corners heuristic pacman(Berkley的AI项目)

时间:2016-09-19 15:11:57

标签: artificial-intelligence heuristics pacman

有人可以建议以下哪种距离公式用于角落启发式问题?

  1. 当我使用曼哈顿距离时,结果不正确。
  2. 当我使用欧氏距离时,pacman在23.5秒后开始移动 这是找到解决方案的时间。
  3. 我无法确定哪个游戏状态可用于 mazeDistance(pos1, pos2,gameState)
  4. heuristic = 0 currentState, visitedCorners = state copyOfVisitedCorners = list(visitedCorners)
        for i in range(4):
                cornerDistance = [0, 0, 0, 0]
                cornerCounter = 0
                for corner in copyOfVisitedCorners:
                    cornerDistance[cornerCounter] = euclidean(currentState,corners[cornerCounter])
                    cornerCounter += 1
                cornerCounter1 = 0
                closestCorner = 0
                for currentValue in cornerDistance:
                    if (copyOfVisitedCorners[closestCorner]):
                        closestCorner = cornerCounter1
                    if (not copyOfVisitedCorners[cornerCounter1]) and (currentValue < cornerDistance[closestCorner]):
                        closestCorner = cornerCounter1
                    cornerCounter1 += 1
                if (not copyOfVisitedCorners[closestCorner]):
                    heuristic += cornerDistance[closestCorner]
                    currentState = corners[closestCorner]
                    copyOfVisitedCorners[closestCorner] = True
            return heuristic
    

0 个答案:

没有答案