Write a program to enable Bill to do the following:
Bill is currently positioned on the corner of 2nd street and 3rd
avenue, facing east. Beepers are placed randomly on corners encompassed by 2nd
and 7th streets, and 3rd and 7th avenues respectively.
The area is framed by wall sections between the 7th and 8th avenues,
and the 2nd and 3rd avenues. Bill is required to pick up all the
beepers (without performing an error shutoff!!). NOTE: There may be more than one beeper
on each street corner.
BEGINNING-OF-PROGRAM DEFINE_NEW-INSTRUCTION turnright AS BEGIN ITERATE 3 TIMES turnleft; END DEFINE-NEW-INSTRUCTION position-for-next-two AS BEGIN turnright; move; turnright; END DEFINE-NEW-INSTRUCTION go-to-next-row AS BEGIN turnleft; move; turnleft; END DEFINE-NEW-INSTRUCTION clear-corner-of-beepers AS BEGIN WHILE next-to-beeper DO pickbeeper; END DEFINE-NEW-INSTRUCTION pick-beeper-if-present AS BEGIN IF next-to-beeper THEN clear-corner-of-beepers; END DEFINE-NEW-INSTRUCTION harvest-a-row AS BEGIN WHILE front-is-clear DO BEGIN pick-beeper-if-present; move; END pickbeeper-if-present; END DEFINE-NEW-INSTRUCTION harvest-2-rows AS BEGIN harvest-a-row; go-to-next-row; harvest-a-row; END BEGINNING-OF-EXECUTION ITERATE 3 TIMES BEGIN harvest-2-rows; position-for-next-two; END move; turnoff; END-OF-EXECUTION END-OF-PROGRAM