|
|
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: 6144 (0x1800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Square, seg_03e0a4
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Io;
with Square;
package body Square is
The_Square : Square;
procedure Move (D : Direction) is
begin
case D is
when North =>
Rc.Row := Rc.Row - 1;
when North_East =>
Rc.Col := Rc.Col + 1;
Rc.Row := Rc.Row - 1;
when North_West =>
Rc.Row := Rc.Row - 1;
Rc.Col := Rc.Col - 1;
when South_West =>
Rc.Row := Rc.Row + 1;
Rc.Col := Rc.Col - 1;
when others =>
[statement]
end case;
if (Rc.Row = 0) then
Rc.Row := N;
end if;
if (Rc.Row > N) then
Rc.Row := Rc.Row - N;
end if;
if (Rc.Col = 0) then
Rc.Col := N;
end if;
if (Rc.Col > N) then
Rc.Col := Rc.Col - N;
end if;
end Move;
procedure Go_To_Center is
begin
Rc := (Row => (N / 2) + 1, Col => (N / 2) + 1);
end Go_To_Center;
procedure Deposit (T : Token) is
begin
The_Square (Rc.Row, Rc.Col) := T;
end Deposit;
procedure Init_Square is
begin
The_Square := Square'(1 .. N => (1 .. N => 0));
end Init_Square;
function Current_Token return Token is
begin
return The_Square (Rc.Row, Rc.Col);
end Current_Token;
procedure Display_Square is
begin
Io.Put (Item => "Carre magique ");
Io.Put (Item => N);
Io.Put_Line (Item => "");
Io.Put
(Item =>
"La somme de chaque ligne, col et diagonale doit etre egale a : ");
Io.Put (Item => (N * ((N * N) + 1) / 2));
Io.Put_Line (Item => "");
Io.Put_Line (Item => "");
for T in 1 .. N loop
for U in 1 .. N loop
Io.Put (Item => (The_Square (T, U)), Width => 5);
end loop;
Io.Put_Line (Item => "");
Io.Put_Line (Item => "");
end loop;
Io.Put_Line (Item => "");
end Display_Square;
procedure Run is
begin
Init_Square;
for U in Token range Token'Succ (Token'First) .. Token'Last loop
if (U = Token'Succ (Token'First)) then
Go_To_Center;
Move (D => North);
else
Move (D => North_East);
while (Current_Token /= Token'First) loop
Move (D => South_West);
Move (D => North_West);
Move (D => North_East);
end loop;
end if;
Deposit (T => U);
end loop;
Display_Square;
end Run;
end Square;
nblk1=5
nid=3
hdr6=6
[0x00] rec0=2a rec1=00 rec2=01 rec3=012
[0x01] rec0=24 rec1=00 rec2=05 rec3=054
[0x02] rec0=20 rec1=00 rec2=04 rec3=000
[0x03] rec0=05 rec1=00 rec2=03 rec3=000
[0x04] rec0=09 rec1=00 rec2=02 rec3=000
tail 0x2173cdcf085fc75ec995b 0x42a00088462060003
Free Block Chain:
0x3: 0000 00 02 03 fc 80 0d 74 20 28 42 6f 78 5f 4c 69 6e ┆ t (Box_Lin┆
0x2: 0000 00 00 03 fc 80 11 65 20 47 6f 5f 54 6f 5f 43 65 ┆ e Go_To_Ce┆