|
|
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 - metrics - downloadIndex: B T
Length: 1717 (0x6b5)
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
package Io is new Text_Io.Integer_Io (Num => Token);
type Cell is
record
Row : Max_Size;
Column : Max_Size;
end record;
Cursor : Cell;
procedure Go_To_Center (S : in Square) is
begin
Cursor.Row := (S.Size / 2) + 1;
Cursor.Column := (S.Size / 2) + 1;
end Go_To_Center;
procedure Move (S : in Square; D : in Direction) is
begin
case D is
when North =>
Cursor.Row := Max_Size'Succ (Cursor.Row mod S.Size);
when East =>
Cursor.Column := Max_Size'Succ (Cursor.Column mod S.Size);
when South =>
if Cursor.Row = Max_Size'First then
Cursor.Row := S.Size;
else
Cursor.Row := Max_Size'Pred (Cursor.Row);
end if;
when West =>
if Cursor.Column = Max_Size'First then
Cursor.Column := S.Size;
else
Cursor.Column := Max_Size'Pred (Cursor.Column);
end if;
end case;
end Move;
procedure Deposit (S : in out Square; T : in Token) is
begin
S.T (Cursor.Row, Cursor.Column) := T;
end Deposit;
function Cell_Busy (S : in Square) return Boolean is
begin
return S.T (Cursor.Row, Cursor.Column) > 0;
end Cell_Busy;
procedure Display (S : in Square) is
begin
for I in reverse 1 .. S.Size loop
for J in 1 .. S.Size loop
Io.Put (S.T (I, J), 6);
end loop;
Text_Io.New_Line;
end loop;
end Display;
end Magic;