Created
June 1, 2013 16:15
-
-
Save lsmolic/5690897 to your computer and use it in GitHub Desktop.
This file contains 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
class YourBody { | |
boolean is_moving = false; | |
String[] known_actions = { "Forward", "Backward", "Left", "Right" }; | |
boolean validRequest( String this_action ){ | |
for ( int i = 0; i < known_actions.length; i++) | |
{ | |
if ( known_actions[i] == this_action ) | |
{ | |
return true; | |
} | |
} | |
return false; | |
} | |
void MoveForward() | |
{ | |
//move legs and stuff | |
} | |
void MoveBackward() | |
{ | |
//move legs differently and that other stuff | |
} | |
} | |
String request = "Forward"; | |
if ( YourBody.validRequest( request ) ) | |
{ | |
if ( request == known_actions[0] ) | |
{ | |
YourBody.MoveForward(); | |
} | |
} else { | |
print("I don’t understand that request..."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment