Last active
December 15, 2016 14:31
-
-
Save LarsBergqvist/7f4ffe2574652e02e8005c623c35dbd3 to your computer and use it in GitHub Desktop.
Call functions according to mappings between characters and objects' functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
action_methods = { | |
'F' : wheels.fw_step, | |
'B' : wheels.back_step, | |
'L' : wheels.turn_left, | |
'R' : wheels.turn_right, | |
'S' : wheels.stop, | |
'U' : hammer.up, | |
'D' : hammer.down, | |
'O' : claws.open, | |
'C' : claws.close | |
} | |
def run(sequence): | |
for action in sequence: | |
if action in action_methods: | |
action_methods[action]() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment