CS108L Week 6 Activity Programyourrobot Solutions
CS108L Week 6 Activity Programyourrobot Solutions
Solutions
Programyourrobot.com
Level
1
MAIN
METHOD
• 1
step
forward
• 1
step
forward
• 1
step
forward
• 1
step
forward
ProgramYourRobot
Solutions
programyourrobot.com
Level
2
MAIN
METHOD
• F1
• Left
turn
• 1
step
forward
• Right
turn
• F1
• Light
Bulb
FUNCTION
1
• 1
step
forward
• 1
step
forward
ProgramYourRobot
Solutions
Programyourrobot.com
Level
3a
MAIN
METHOD
• F2
• F1
• F2
• 1
step
forward
• Light
FUNCTION
1
• Left
turn
• F2
• Right
turn
FUNCTION
2
• 1
step
forward
• 1
step
forward
• 1
step
forward
ProgramYourRobot
Solutions
programyourrobot.com
Level
3aa
MAIN
METHOD
• F2
• F1
• F2
• 1
step
forward
• Light
FUNCTION
1
• Left
turn
• F2
• Right
turn
FUNCTION
2
• 1
step
forward
• 1
step
forward
• 1
step
forward
ProgramYourRobot
Solutions
Programyourrobot.com
Level
3b
MAIN
METHOD
• F1
• F2
• 1
step
forward
• Light
FUNCTION
1
• Left
turn
• F2
• Right
turn
FUNCTION
2
• 1
step
forward
• 1
step
forward
• 1
step
forward
ProgramYourRobot
Solutions
programyourrobot.com
LEVEL
4
MAIN
METHOD
• F1
• F2
• Monster
Confrontation
–
2
steps
forward
• F1
• Right
turn
• F1
• Light
FUNCTION
1
• 1
step
forward
• 1
step
forward
• 1
step
forward
FUNCTION
2
• Left
turn
• 1
step
forward
ProgramYourRobot
Solutions
Programyourrobot.com
Level
5
MAIN
METHOD
• Loop
1
–
1
step
forward
repeated
4
times
• F1
• Loop
2
–
1
step
forward
repeated
4
times
• F2
• Loop
3
–
1
step
forward
repeated
4
times
• Left
turn
• 1
step
forward
• Light
FUNCTION
1
• Left
turn
• 1
step
forward
• 1
step
forward
• Left
turn
FUNCTION
2
• Right
turn
• 1
step
forward
• 1
step
forward
• Right
turn
ProgramYourRobot
Solutions
programyourrobot.com
Level 6
FUNCTION 1
• Loop 1 - 1 step forward repeated 4 times
• Left turn
• 1 step forward
• Monster confrontation – 1 step forward left turn
• Loop 2 – 1 step forward repeated 4 times
• Right turn
• Loop 3 – 1 step forward repeated 2 times
• Right turn
FUNCTION 2
• Loop 1 - 1 step forward repeated 4 times
• Left turn
• Left turn
• Loop 2 – 1 step forward repeated 2 times
• Right turn
• Loop 3 – 1 step forward repeated 2 times