DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 2128 (0x850) Types: TextFile Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧
with Square, Text_Io; package body Square is procedure Move (D : Direction; Tab : in out Magic_Square) is begin case D is when North => if Tab.Row = Tab.Table'First (2) then Tab.Row := Tab.Table'Last (2); else Tab.Row := Tab.Row - 1; end if; when West => if Tab.Line = Tab.Table'First (1) then Tab.Line := Tab.Table'Last (1); else Tab.Line := Tab.Line - 1; end if; when East => if Tab.Line = Tab.Table'Last (1) then Tab.Line := Tab.Table'First (1); else Tab.Line := Tab.Line + 1; end if; end case; end Move; procedure Display_Zero (Tab : in out Magic_Square) is begin for R in Tab.Table'Range (2) loop for L in Tab.Table'Range (1) loop Tab.Table (L, R) := 0; end loop; end loop; end Display_Zero; procedure Walking (Tab : in out Magic_Square) is X : Natural; begin X := 1; Tab.Table (Tab.Line, Tab.Row) := X; X := X + 1; while not (X > (Tab.Dim ** 2)) loop Move (North, Tab); Move (East, Tab); if Tab.Table (Tab.Line, Tab.Row) = 0 then Tab.Table (Tab.Line, Tab.Row) := X; else Move (North, Tab); Move (West, Tab); Tab.Table (Tab.Line, Tab.Row) := X; end if; X := X + 1; end loop; end Walking; procedure Display (Tab : in out Magic_Square) is package Io is new Text_Io.Integer_Io (Integer); begin Display_Zero (Tab); Walking (Tab); for Row in Tab.Table'Range (2) loop for Line in Tab.Table'Range (1) loop Io.Put (Tab.Table (Line, Row)); end loop; Text_Io.Put_Line (""); end loop; end Display; end Square;