Wanderer Package Separate Function |
Download |
Function Rename 1 |
--
-- Wander client procedure.
--
with Text_IO;
with Gnat.Io; use Gnat.Io;
with Wander; use Wander;
procedure Wandcli is
L: Locator;
procedure PrintLoc(L: Locator) is
-- Print directions.
package Dir_Inst_IO is new Text_Io.Enumeration_IO(Direction_Instruction);
use Dir_Inst_Io;
Dir: Direction_Instruction; -- How to go home.
I: Integer;
begin
Put("We Are "); Put(How_Far_Home(L)); Put(" blocks from home. ");
Dir := Toward_Home(L);
if Dir = Stop then
Put_Line("We can stop now.");
else
I := Toward_Home(L);
Put("Walk "); Put(Dir); Put(" "); Gnat.Io.Put(I);
Put_Line(" blocks.");
end if;
end PrintLoc;
begin
Walk(L, North, 5);
Walk(L, West, 3);
PrintLoc(L);
Walk(L, South, 8);
Walk(L, East, 2);
PrintLoc(L);
Walk(L, North, 7);
Walk(L, East, 3);
Walk(L, South, 4);
PrintLoc(L);
Walk(L, West, 2);
PrintLoc(L);
end Wandcli;
Wanderer Package Separate Function |
Function Rename 1 |