Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Imagine that you have created a mechanical robot. The ONLYcommands this robot ca

ID: 3613531 • Letter: I

Question

Imagine that you have created a mechanical robot. The ONLYcommands this robot can understand are:

StandUp

SitDown

Turn left 90degrees

Turn right 90degrees

Take astep

To test your robot, I have placed two chairs, 12 steps apart,directly facing each other. Write an algorithm to describethe logic, using only the commands above, which would allow therobot to start from a sitting position in one chair, cross thedistance, and end up sitting in the other chair.

I want you to list the commands you must give the robot toaccomplish this test. Begin with “Start” and endwith “Stop”. All other statements must come fromthe list above. You cannot combine any instructions –THE ONLY COMMANDS THE ROBOT UNDERSTANDS ARE THE FIVE COMMANDS ABOVEand those are the only commands you can use.

Explanation / Answer

Okay, this is pretty simple, just use logic. Start     Stand Up     Take a step     Take a step     Take a step     Take a step     Take a step     Take a step     Take a step     Take a step     Take a step     Take a step     Take a step     Take a step         Turn left 90 degrees     Turn left 90 degrees     Sit Down Stop That is how you would do it with the description you gave. I wouldpersonally create some kind of loop for the stepping. Also whenturning the robot, you can turn it right or left twice, because inboth cases it will be turned 180 degrees. With a loop, it can bewritten as follows: Start     Stand Up      for (int i = 1; i