multiAgent.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:xiao_multiagent 作者: namidairo777 项目源码 文件源码
def generateSuccessor(self, action, agentIndex):
        """
        Returns the successor state after the specified pursuer takes action
        """
        # Check that successors exist
        if self.isWin() or self.isLose(): 
            # time.sleep(2)
            raise Exception('Game over')

        # Copy current state
        state = GameState(self)

        # Let agent's logic deal with its action's effects on the board
        if agentIndex == 0:  # Pacman is moving
            # state.data._eaten = [False for i in range(state.getNumAgents())]
            TargetRules.applyAction( state, action )
        else:                # A ghost is moving
            PursuerRules.applyAction( state, action, agentIndex )


        # Book keeping
        #state.data._agentMoved = agentIndex
        state.data.score += state.data.scoreChange
        GameState.explored.add(self)
        GameState.explored.add(state)
        return state
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号