DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦444b92fb4⟧ TextFile

    Length: 2077 (0x81d)
    Types: TextFile
    Names: »B«

Derivation

└─⟦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⟧ 

TextFile

with Text_Io;
package body Square is
    subtype Size is Natural range 1 .. 5;
    type Table is array (Size, Size) of Token;

    type Cell is
        record
            Line : Size;
            Column : Size;
        end record;

    Cursor : Cell;
    The_Table : Table;

    procedure Move (D : Direction) is
    begin
        case D is
            when North =>
                if Cursor.Line < Size'Last then
                    Cursor.Line := Size'Succ (Cursor.Line);
                else
                    Cursor.Line := Size'First;
                end if;
            when South =>
                if Cursor.Line > Size'First then
                    Cursor.Line := Size'Pred (Cursor.Line);
                else
                    Cursor.Line := Size'Last;
                end if;
            when East =>
                if Cursor.Column < Size'Last then
                    Cursor.Column := Size'Succ (Cursor.Column);
                else
                    Cursor.Column := Size'First;
                end if;
            when West =>
                if Cursor.Column > Size'First then
                    Cursor.Column := Size'Pred (Cursor.Column);
                else
                    Cursor.Column := Size'Last;
                end if;
        end case;
    end Move;

    procedure Go_To_Center is
    begin
        Cursor.Line := 3;
        Cursor.Column := 3;
    end Go_To_Center;

    procedure Deposit (T : Token) is
    begin
        The_Table (Cursor.Line, Cursor.Column) := T;
    end Deposit;

    function Cell_Busy return Boolean is
    begin
        return The_Table (Cursor.Line, Cursor.Column) > 0;
    end Cell_Busy;

    procedure Display is
        package Io is new Text_Io.Integer_Io (Token);
    begin
        for I in reverse Size loop
            for J in Size loop
                Io.Put (The_Table (I, J));
            end loop;
            Text_Io.New_Line;
        end loop;
    end Display;

begin
    for I in Size loop
        for J in Size loop
            The_Table (I, J) := 0;
        end loop;
    end loop;
end Square;