|
|
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: 1653 (0x675)
Types: TextFile
Names: »B«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
with Io;
package body Square is
-- definition of the actual 'checker-board' as a vector (just for
-- the fun of it) with constant specification
Size_2 : constant Positive := Size ** 2;
subtype Edge is Natural range 0 .. Size ** 2 - 1;
Board : array (Edge) of Natural := (others => 0);
-- position of the cursor
X : Edge := Size_2 / 2;
procedure Go_To_Center is
begin
X := Size_2 / 2;
end Go_To_Center;
procedure Go (Which_Direction : in Direction) is
begin
case Which_Direction is
when North | North_East | North_West =>
X := (X - Size) mod Size_2;
when South | South_East | South_West =>
X := (X + Size) mod Size_2;
when others =>
null;
end case;
case Which_Direction is
when East | North_East | South_East =>
X := ((X / Size) * Size + (((X mod Size) + 1) mod Size));
when West | North_West | South_West =>
X := ((X / Size) * Size + (((X mod Size) - 1) mod Size));
when others =>
null;
end case;
end Go;
function Is_Already_Occupied return Boolean is
begin
return Board (X) > 0;
end Is_Already_Occupied;
procedure Deposit (Token : Positive) is
begin
Board (X) := Token;
end Deposit;
procedure Display is
begin
for X in Edge loop
if X mod Size = 0 then
Io.New_Line;
end if;
Io.Put (Board (X), Width => 4);
end loop;
Io.New_Line;
end Display;
end Square;