Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rachel the Robot lives in the world on the next slide. We want Rachel to double the number of beepers on a corner in the

Rachel the Robot lives in the world on the next slide. We want Rachel to double the number of beepers on a corner 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 Rachel

Rachel has an infinite number of beepers in her bag

Rachel understands the following commands

move() takes one step forward

turn() turns left 90 degrees

pickUpBeeper() 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.

Rachel knows how to do the following tests

beepersPresent() returns true if there is at least 1 beeper on the spot Rachel is standing

For example,we started with 5 beepers in the space next to rachel and ended with 10 beepers in the space next to rachel

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Microsoft Outlook 2023

Authors: James Holler

1st Edition

B0BP9P1VWJ, 979-8367217322

More Books

Students also viewed these Databases questions

Question

Does it avoid use of underlining?

Answered: 1 week ago