Question: Write a program to make BeeperBot (BB) draw a filled-in square, based on her initial position and the number of beepers she is initially holding.
Write a program to make BeeperBot (BB) draw a filled-in square, based on her initial position and the number of beepers she is initially holding.
The Southwest corner of the square should be just east of BB's initial position, and the height (and width) of the square is the number of beepers that BB is initially holding. After drawing the square, BB must end at the exact same position she started at, and then face east. Your program must work correctly for any initial position, any initial direction and any number (including zero) of initial beepers. For example, if BB starts at (1,3):
and is holding 4 beepers, the following square should be drawn:
If, on the other hand, the bot is initially holding two beepers, the following square should be drawn:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
