Skip to content

Instantly share code, notes, and snippets.

@lsmolic
Created June 1, 2013 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmolic/5690897 to your computer and use it in GitHub Desktop.
Save lsmolic/5690897 to your computer and use it in GitHub Desktop.
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