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

⟦6161e1d78⟧ Ada Source

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

Derivation

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

E3 Source Code



with Io;
package body Square is
    procedure Move (D : Direction) is
    begin
        case D is
            when North =>
                P.Line := P.Line - 1;
            when South =>
                P.Line := P.Line + 1;

            when East =>
                P.Col := P.Col + 1;

            when West =>
                P.Col := P.Col - 1;

            when North_East =>
                P.Line := P.Line - 1;
                P.Col := P.Col + 1;
            when North_West =>
                P.Line := P.Line - 1;
                P.Col := P.Col - 1;

        end case;
        if (P.Line = 0) then
            P.Line := Size;
        end if;

        if (P.Line > Size) then
            P.Line := P.Line - Size;
        end if;
        if (P.Col = 0) then
            P.Col := Size;
        end if;

        if (P.Col > Size) then
            P.Col := P.Col - Size;
        end if;

    end Move;


    procedure Go_To_Center is
    begin
        P := (Col => (Size + 1) / 2, Line => (Size + 1) / 2);
    end Go_To_Center;


    procedure Deposit (T : Token) is
    begin
        S (P.Line, P.Col) := T;
    end Deposit;


    procedure Init is
    begin
        for L in 1 .. Size loop
            for C in 1 .. Size loop
                S (L, C) := 0;
            end loop;
        end loop;
    end Init;


    procedure Show is
    begin
        Io.Put (Item => "Magic Square");
        Io.Put (Item => Size);
        Io.Put_Line (Item => "");
        Io.Put (Item => "somme = ");
        Io.Put (Item => (Size * ((Size * Size) + 1) / 2));
        Io.Put_Line (Item => "");
        Io.Put_Line (Item => "");

        for L in 1 .. Size loop
            for C in 1 .. Size loop
                Io.Put (Item => (S (L, C)), Width => 4);
            end loop;
            Io.Put_Line (Item => "");
            Io.Put_Line (Item => "");
        end loop;       Io.Put_Line (Item => "");
    end Show;

    function Current_Token return Token is
    begin
        return S (P.Line, P.Col);
    end Current_Token;



end Square;

E3 Meta Data

    nblk1=4
    nid=4
    hdr6=6
        [0x00] rec0=2c rec1=00 rec2=01 rec3=022
        [0x01] rec0=27 rec1=00 rec2=02 rec3=002
        [0x02] rec0=0b rec1=00 rec2=03 rec3=000
        [0x03] rec0=06 rec1=5f rec2=25 rec3=242
    tail 0x21766c2e488df5c4862fa 0x42a00088462060003
Free Block Chain:
  0x4: 0000  00 00 01 d5 80 07 3d 3e 20 22 22 29 3b 07 00 1f  ┆      => "");   ┆