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

⟦6ef714fc9⟧ Ada Source

    Length: 6144 (0x1800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Square, seg_03e004

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 Square;
with Io;
package body Square is
    procedure Move (D : Direction) is
    begin
--        Io.Put (Item => "coordonnees L C avant move ");
--        Io.Put (Item => Tocken'Image (Lc.Ligne));
--        Io.Put_Line (Item => Tocken'Image (Lc.Colom));
        case D is
            when North =>
                Lc.Ligne := Lc.Ligne - 1;

            when South =>
                Lc.Ligne := Lc.Ligne + 1;

            when East =>
                Lc.Colom := Lc.Colom + 1;

            when West =>
                Lc.Colom := Lc.Colom - 1;

            when North_East =>
                Lc.Ligne := Lc.Ligne - 1;
                Lc.Colom := Lc.Colom + 1;

            when North_West =>
                Lc.Ligne := Lc.Ligne - 1;
                Lc.Colom := Lc.Colom - 1;

        end case;
        if (Lc.Ligne = 0) then
            Lc.Ligne := Tab_Size;
        end if;

        if (Lc.Ligne > Tab_Size) then
            Lc.Ligne := Lc.Ligne - Tab_Size;
        end if;

        if (Lc.Colom = 0) then
            Lc.Colom := Tab_Size;
        end if;

        if (Lc.Colom > Tab_Size) then
            Lc.Colom := Lc.Colom - Tab_Size;
        end if;
--        Io.Put (Item => "coordonnees L C apres move");
--        Io.Put (Item => Tocken'Image (Lc.Ligne));
--        Io.Put_Line (Item => Tocken'Image (Lc.Colom));

    end Move;


    procedure Goto_Center is
    begin
        Lc := (Colom => (Tab_Size + 1) / 2, Ligne => (Tab_Size + 1) / 2);
--        Io.Put (Item => "coordonnees L C ");
--        Io.Put (Item => Tocken'Image (Lc.Ligne));
--        Io.Put_Line (Item => Tocken'Image (Lc.Colom));
    end Goto_Center;


    procedure Deposit (T : Tocken) is
    begin
        My_Square (Lc.Ligne, Lc.Colom) := T;
    end Deposit;


    procedure Init_Square is
    begin
        for L in 1 .. Tab_Size loop
            for C in 1 .. Tab_Size loop
                My_Square (L, C) := 0;
            end loop;
        end loop;
    end Init_Square;


    procedure Display_Square is
    begin
        Io.Put (Item => "je suis le carre magique de ");
        Io.Put (Item => Tab_Size);
        Io.Put_Line (Item => "");
        Io.Put (Item => "La somme de chaque ligne ou  colonne est egale a : ");
        Io.Put (Item => (Tab_Size * ((Tab_Size * Tab_Size) + 1) / 2));
        Io.Put_Line (Item => "");
        Io.Put_Line (Item => "");
        for L in 1 .. Tab_Size loop
            for C in 1 .. Tab_Size loop
                Io.Put (Item => (My_Square (L, C)), Width => 4);
            end loop;
            Io.Put_Line (Item => "");
            Io.Put_Line (Item => "");
        end loop;
        Io.Put_Line (Item => "");

    end Display_Square;

    function Current_Tocken return Tocken is
    begin
        return My_Square (Lc.Ligne, Lc.Colom);
    end Current_Tocken;


end Square;

E3 Meta Data

    nblk1=5
    nid=4
    hdr6=6
        [0x00] rec0=25 rec1=00 rec2=01 rec3=02c
        [0x01] rec0=24 rec1=00 rec2=02 rec3=02c
        [0x02] rec0=22 rec1=00 rec2=03 rec3=000
        [0x03] rec0=22 rec1=00 rec2=03 rec3=000
        [0x04] rec0=05 rec1=00 rec2=05 rec3=000
    tail 0x21536689e85fc714fb011 0x42a00088462060003
Free Block Chain:
  0x4: 0000  00 05 00 06 80 03 65 20 3a 03 04 05 06 07 08 09  ┆      e :       ┆
  0x5: 0000  00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00  ┆                ┆