def step(self, action):
"""
(!)for reinforcement learning only(!) WIP:
Executes one action on the game.
The action gets translated into a keyboard sequence first, then is played.
:param str action: the action to execute on the MDP
"""
# default global events?
events = pygame.event.get(pygame.QUIT) # TODO: add more here?
for e in events:
if e.type == pygame.QUIT:
raise (SystemExit, "QUIT")
# collect keyboard events
self.keyboard_inputs.tick()
# call the callback with self (for references to important game parameters)
self.callback(self)
# increase global frame counter
self.frame += 1
评论列表
文章目录