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: 2525 (0x9dd) Types: TextFile Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧ └─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04 └─ ⟦d65440be7⟧ »DATA« └─⟦this⟧
with Text_Io; package body Magic is procedure Move (Dir : in Direction; Tab : in out Square) is begin case Dir is when North => if Tab.A'First (1) = Tab.Current_Line then Tab.Current_Line := Tab.A'Last (1); else Tab.Current_Line := Line'Pred (Tab.Current_Line); end if; when East => if Tab.Current_Row = Tab.A'Last (2) then Tab.Current_Row := Tab.A'First (2); else Tab.Current_Row := Row'Succ (Tab.Current_Row); end if; when West => if Tab.Current_Row = Tab.A'First (2) then Tab.Current_Row := Tab.A'Last (2); else Tab.Current_Row := Row'Pred (Tab.Current_Row); end if; end case; end Move; procedure Set (X : in Token; Tab : in out Square) is begin Tab.A (Tab.Current_Line, Tab.Current_Row) := X; end Set; function Full (Tab : in Square) return Boolean is begin return (Tab.A (Tab.Current_Line, Tab.Current_Row) > 0); end Full; procedure Display (Tab : in out Square) is package Io is new Text_Io.Integer_Io (Token); begin Walking (Tab); for I in Tab.A'Range (1) loop for J in Tab.A'Range (2) loop Io.Put (Tab.A (I, J)); end loop; Text_Io.Put_Line (""); end loop; Text_Io.Put_Line (""); end Display; procedure Walking (Tab : in out Square) is X : Token := 1; begin Tab.Current_Line := Tab.A'Last (1) / 2; Tab.Current_Row := Tab.A'Last (2) / 2 + 1; Set (X, Tab); while X < Tab.A'Last (1) * Tab.A'Last (2) loop while Full (Tab) loop Move (East, Tab); Move (North, Tab); if Full (Tab) then Move (West, Tab); Move (North, Tab); end if; end loop; X := X + 1; Set (X, Tab); end loop; end Walking; procedure Blanking (Tab : in out Square) is begin for I in Tab.A'Range (1) loop for J in Tab.A'Range (2) loop Tab.Current_Line := I; Tab.Current_Row := J; Set (0, Tab); end loop; end loop; end Blanking; end Magic;