define-new-instruction about-face as
define-new-instruction face-north as
define-new-instruction face-south as
define-new-instruction face-east as
define-new-instruction face-west as
define-new-instruction go-to-wall as
define-new-instruction move-1-block-north as
define-new-instruction move-1-block-south as
define-new-instruction move-1-block-east as
define-new-instruction move-1-block-west as
define-new-instruction go-to-next-diagonal as
define-new-instruction zag-down-right as
define-new-instruction zig-left-up as
define-new-instruction zag-move as
define-new-instruction zig-move as
define-new-instruction go-to-origin as
define-new-instruction find-beeper as
define-new-instruction compute-sum as
beginning-of-execution
begin
turnleft;
turnleft;
end;
begin
while not-facing-north do
turnleft;
end;
begin
while not-facing-south do
turnleft;
end;
begin
while not-facing-east do
turnleft;
end;
begin
while not-facing-west do
turnleft;
end;
begin
while front-is-clear do
move;
end;
begin
move;
end;
begin
move;
end;
begin
move;
end;
begin
move;
end;
begin
if facing-west then
face-north
else face-east;
move;
about-face;
end;
begin
move-1-block-south;
face-east;
move-1-block-east;
face-south;
end;
begin
move-1-block-west;
face-north;
move-1-block-north;
face-west;
end;
begin
if front-is-clear then
zag-down-right
else go-to-next-diagonal;
end;
begin
if front-is-clear then
zig-left-up
else go-to-next-diagonal;
end;
begin
face-west;
go-to-wall;
face-south;
go-to-wall;
end;
begin
go-to-origin;
face-west;
while not-next-to-a-beeper do
begin
if facing-west then
zig-move
else zag-move;
end;
end;
begin
while front-is-clear do
zag-down-right;
go-to-next-diagonal;
end;
find-beeper;
compute-sum;
putbeeper;
face-east;
move;
about-face;
turnoff;
end-of-execution
end-of-program
Copyright © 2004 by
William J. Rapaport
(rapaport@cse.buffalo.edu)
file: 111F04/add-2004-11-29.html