interface.py 文件源码

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

项目:aaai-platformer 作者: WarwickMasson 项目源码 文件源码
def control_update(self):
        ''' Uses input from the keyboard to control the player. '''
        keys_pressed = pygame.key.get_pressed()
        action_map = {
            pygame.K_SPACE: ('hop', INITIAL_HOP),
            pygame.K_l: ('leap', INITIAL_LEAP),
            pygame.K_d: ('run', 2),
        }
        action = ('run', 0)
        for key in action_map:
            if keys_pressed[key]:
                action = action_map[key]
                break
        reward, end_episode = self.simulator.update(action, DT, True)
        self.total += reward
        if end_episode:
            print 'Episode Reward:', self.total
            self.total = 0.0
            self.simulator = Simulator()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号