Enter and run the following new program You should recognize

Enter and run the following new program: You should recognize the resulting display as the \"9 dots\" problem. Note how this program generates this display by using an inner column loop \"nested\" inside an outer row loop. Without changing any of the above given code, program your robot to solve the 9 dots problem by using a single rPen command and exactly four rForward commands (you will also need a rLocate and some rTurn commands). Start by first writing down the required steps in proper order or by drawing a flowchart of your solution, and then implement your \"recipe\" using Robot BASIC. Add comment line(s) at the beginning of this program with program title, student names, and date. Save your program solution to show to the instructor.

Solution

radius = 8

rPen down

For row=1 to 3

For col=1 to 3

x = 100*col

y = 100*row

Circle x-radius,y-radius,x+radius,y+radius,BLACK,BLACK

while ! ( rfeel () & 4)

rForward 1

wEnd

while ! ( rfeel () & 16)

rTurn 1

wEnd

While True

while ! ( rfeel () & 8)

rturn -1

wEnd

while ! ( rfeel () & 8)

rForward 1

wEnd

Next col

while ! ( rfeel () & 4)

rForward 1

wEnd

while ! ( rfeel () & 16)

rTurn 1

wEnd

While True

while ! ( rfeel () & 8)

rturn -1

wEnd

while ! ( rfeel () & 8)

rForward 1

wEnd

Next row

// your code here

end

 Enter and run the following new program: You should recognize the resulting display as the \
 Enter and run the following new program: You should recognize the resulting display as the \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site