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

⟦6ec855230⟧ Ada Source

    Length: 3072 (0xc00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Carre_Magique, seg_0564c7

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



package body Carre_Magique is

    procedure Move (M : Matrice; X, Y : in out Integer) is
        [declaration]
    begin
        if X = M'Last (1) then
            X := M'First (1);
        else
            X := X + 1;
        end if;
        if Y = M'First (2) then
            Y := M'Last (2);
        else
            Y := Y - 1;
        end if;
        while M (X, Y) /= 0 loop
            if X = M'First (1) then
                X := M'Last (1);
            else
                X := X - 1;
            end if;
            if Y = M'First (2) then
                Y := M'Last (2);
            else
                Y := Y - 1;
            end if;
        end loop;  
    end Move;

    procedure Init_Magic_Square (M : in out Matrice) is
        X, Y : Indice;
        N, I : Integer;
    begin
        X := ((M'First (1) + M'Last (1)) / 2) - 1;
        Y := X + 1;
        N := M'Last (1) - M'First (1) + 1;
        N := N ** 2;
        for I in 1 .. N loop  
            Move (M, X, Y);
            M (X, Y) := I;
        end loop;
    end Init_Magic_Square;


    procedure Display_Magic_Square (M : in Matrice) is
        X, Y : Integer;
    begin
        for Y in M'Range (1) loop
            for X in M'Range (2) loop
                Text_Io.Put (Integer'Image (M (X, Y)) & " ");
            end loop;
            Text_Io.New_Line;
        end loop;
    end Display_Magic_Square;
end Carre_Magique;

E3 Meta Data

    nblk1=2
    nid=0
    hdr6=4
        [0x00] rec0=27 rec1=00 rec2=01 rec3=006
        [0x01] rec0=12 rec1=00 rec2=02 rec3=001
    tail 0x21762338687c438713513 0x42a00088462060003