# In-Class Exercise: Hand Choreography¶

Objective: develop an algorithmic notation for specifying choreography of hand motions within a class videoconference stream.

A key principle of programming is functional decomposition. A key principle of human and robot motion analysis is the identification of motion primitives. These ideas can come together into a domain-specific language for hand choreography.

## Initial Language¶

The language control flow notation will be borrowed from Arduino C++, but the functions will be restricted to a few primitives:

 void tempo(int bpm); Set the global tempo in beats per minute. enum {up, down, left, right, none}; Constants to designate an edge of the camera view, or none for out of view. void hand(int place); Place a single hand for a single beat at the designated location. void pause(int beats); Keep the hand stationary for the designated number of beats.

Code example:

void loop(void)
{
tempo(30);
for (int i = 0; i < 2; i++) {
clockwise();
pause(2);
}
}

void clockwise(void)
{
hand(up);
hand(right);
hand(down);
hand(left);
}


## Phase 1: Develop a Phrase¶

Please meet with your partner for a few minutes to prepare and practice a short choreographic program of your own devising. You’ll be asked to post your code into the chat stream, demonstrate it for the class, then lead the class in trying it out.

## Phase 2: Develop a Parameterized Primitive¶

In a second brief meeting with your partner, you’ll devise an extension to the language, then develop and practice a short demonstration using it.

This is the essential objective of the exercise: analyzing a choreography idea, deciding which properties are fixed or variable, naming the parameters, and either extending an existing motion function or creating a new one.

Some example extensions:

void hands(int side, bool palm_out);
void hands(int side, bool fingers_bent);
void two_hands(int left_hand_side, int right_hand_side);


Please keep your choices within reason to perform with minimal practice, e.g. if you try specifying each individual finger angle it may not be humanly possible without extensive training.

As in the previous phase, please be sure to write your demo in legible code. Please use looping constructs and nested functions as appropriate to create a compact representation.