Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 1 - Problem 1 Chase the Robot lives in the world on the next slide. We want Chase to double the number of beepers

Lab 1- Problem 1
Chase the Robot lives in the world on the next slide. We want Chase to double the number of beepers on a corner (dot) in the world. Provide the algorithm needed to double the pile of beepers. You can assume the following:
There is a finite number of beepers on the corner directly in front of Chase
Chase has an infinite number of beepers in the bag
Chase understands the following commands:
move()- takes one step forward
turnleft ()= turns left 90 degrees
pickUpBseper()- picks up 1 beeper from the floor and puts it in the bag
putBeeper()- puts one beeper on the floor from the bag
repeat x times / End - statements between the x and the End will be repeated x times
while ?/ End - statements between the ? Condition and the End will repeat as long as the ? Condition returns true
Chase knows how to do the following tests
beepersPresent()- returns true if there is at least 1 beeper on the spot Chase is standing
1
Lab 1- Problem 1
For example, in the diagram below we started with 5 beepers and ended with 10.
2
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions