State Diagram top
Pseudocode top
Repeat forever
Repeat until coin is found
Check for coinEnd
Check for hand
If music timer is expired
Stop musicIf Hand is found (Hand is present, was not previously present, and music is not already playing)
Reset timer
Start music timer
Start music
Start game timer
Repeat until game timer expires or claw button is pushed
If music timer is expiredEnd
Stop musicGet X joystick input
Reset timer
Update X motor
Get Y joystick input
Update Y motor
If claw button is pushed
Drop clawEnd
Close claw
Raise claw
Move claw above return chute
Open claw