DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦813ac32b1⟧ Ada Source

    Length: 5120 (0x1400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Square, seg_02fc6a

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Text_Io;
package body Square is

    Magic_Tab : array (Dimension, Dimension) of Token;
    X_Tab, Y_Tab : Integer;

    procedure Init_Magic_Tab is
        I, J : Integer;
    begin
        for I in Magic_Tab'Range (1) loop
            for J in Magic_Tab'Range (2) loop
                Magic_Tab (I, J) := 0;
            end loop;
        end loop;
    end Init_Magic_Tab;

    procedure Move (D : Direction) is
    begin  
        case D is
            when North =>
                Y_Tab := Y_Tab - 1;
            when East =>
                X_Tab := X_Tab + 1;
            when West =>
                X_Tab := X_Tab - 1;

        end case;
        Wrap;
    end Move;

    procedure Go_To_Center is
        Center : Integer;
    begin
        Center := (Dimension'Last / 2) + 1;
        X_Tab := Center;
        Y_Tab := Center;
    end Go_To_Center;

    procedure Deposit (T : Token) is
    begin
        Magic_Tab (Y_Tab, X_Tab) := T;
    end Deposit;


    function Cell_Busy return Boolean is
    begin
        if Magic_Tab (Y_Tab, X_Tab) /= 0 then
            return True;
        else
            return False;
        end if;
    end Cell_Busy;

    function Out_Of_Range (D : Direction) return Boolean is
    begin

        if Y_Tab >= 1 and X_Tab <= 5 and X_Tab >= 1 then
            return False;
        else
            return True;
        end if;
    end Out_Of_Range;

    procedure Wrap is  
    begin
        if Y_Tab = 0 then
            Y_Tab := Dimension'Last;
        else
            if X_Tab = 0 then
                X_Tab := Dimension'Last;
            else
                if X_Tab > 5 then
                    X_Tab := Dimension'First;
                end if;
            end if;
        end if;
    end Wrap;

    procedure Display_Square is
        package Io is new Text_Io.Integer_Io (Num => Token);
        I, J : Integer;
    begin
        for I in Magic_Tab'Range (1) loop
            for J in Magic_Tab'Range (2) loop
                Io.Put (Magic_Tab (I, J));
            end loop;
            Text_Io.New_Line;
        end loop;

    end Display_Square;
end Square;

E3 Meta Data

    nblk1=4
    nid=4
    hdr6=6
        [0x00] rec0=2a rec1=00 rec2=01 rec3=030
        [0x01] rec0=29 rec1=00 rec2=02 rec3=006
        [0x02] rec0=0a rec1=00 rec2=03 rec3=000
        [0x03] rec0=02 rec1=82 rec2=ec rec3=242
    tail 0x21528fdf88493850db4e9 0x42a00088462060003
Free Block Chain:
  0x4: 0000  00 00 01 4c 80 1c 6f 2e 49 6e 74 65 67 65 72 5f  ┆   L  o.Integer_┆