Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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