forked from Telos4/RoboRally
implemented stepping mode
This commit is contained in:
parent
57cd60de8c
commit
4c3c3f973e
|
@ -420,6 +420,9 @@ class Game:
|
|||
elif event.key == pygame.K_r:
|
||||
# run program
|
||||
self.state = 'running'
|
||||
elif event.key == pygame.K_s:
|
||||
self.state = 'manual'
|
||||
self.prg.step()
|
||||
return self.state
|
||||
|
||||
def reset(self):
|
||||
|
@ -442,6 +445,8 @@ class Game:
|
|||
self.state = self.reset()
|
||||
elif self.state == 'quit':
|
||||
running = False
|
||||
elif self.state == 'manual':
|
||||
pass
|
||||
else:
|
||||
print("unknown state")
|
||||
return
|
||||
|
@ -453,3 +458,7 @@ if __name__ == "__main__":
|
|||
random.seed(42)
|
||||
game = Game(dimx=7, dimy=4, robotx=3, roboty=1)
|
||||
game.run()
|
||||
|
||||
# TODOs
|
||||
# - in stepping mode (s) it is possible to drive outside of the map
|
||||
# - when no P0 command is present the program counter will overflow
|
Loading…
Reference in New Issue
Block a user