|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 5120 (0x1400)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Maze, seg_0582e5
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Screen_Io;
use Screen_Io;
with System;
with Random_Numbers;
use Random_Numbers;
package body Maze is
function Next_Pos (P : Position; D : Direction) return Position is
New_P : Position := P;
begin
case D is
when Up =>
New_P.Row := P.Row - 1;
when Right =>
New_P.Col := P.Col + 1;
when Down =>
New_P.Row := P.Row + 1;
when Left =>
New_P.Col := P.Col - 1;
end case;
if New_P.Row > 23 or New_P.Row < 1 or
New_P.Col > 80 or New_P.Col < 1 then
return P;
else
return New_P;
end if;
end Next_Pos;
function Right_Of (D : Direction) return Direction is
begin
return Direction'Val ((Direction'Pos (D) + 1) mod 4);
end Right_Of;
function Left_Of (D : Direction) return Direction is
begin
return Direction'Val ((Direction'Pos (D) + 3) mod 4);
end Left_Of;
function Back_Of (D : Direction) return Direction is
begin
return Direction'Val ((Direction'Pos (D) + 2) mod 4);
end Back_Of;
function Open (P : Position) return Boolean is
-- Determine whether a given location has already been explored.
begin
return Dist (P.Row, P.Col) = Max_Dist;
end Open;
procedure Mark (P : Position; D : Direction) is
-- Indicate on the screen the current position of an exploring task.
C : Character;
begin
-- case System.System_Name is
-- when System.Pc_Dos =>
-- if D = Up then
-- C := Ascii.Can;
-- elsif D = Down then
-- C := Ascii.Em;
-- elsif D = Left then
-- C := Ascii.Dc1;
-- elsif D = Right then
-- C := Ascii.Dle;
-- end if;
-- when others =>
if D = Up or D = Down then
C := '|';
else
C := '-';
end if;
-- end case;
Putc (C, P.Row, P.Col);
end Mark;
procedure New_Maze (Start, Goal : Position;
Num_Lines : Integer) is separate;
begin
-- initialize dist to indicate that all is terra incognita.
for I in Dist'Range (1) loop
for J in Dist'Range (2) loop
Dist (I, J) := 0;
end loop;
end loop;
end Maze;
nblk1=4
nid=0
hdr6=8
[0x00] rec0=25 rec1=00 rec2=01 rec3=030
[0x01] rec0=01 rec1=00 rec2=04 rec3=010
[0x02] rec0=1e rec1=00 rec2=03 rec3=018
[0x03] rec0=14 rec1=00 rec2=02 rec3=000
tail 0x217658ce287e2840fcf70 0x42a00088462060003