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

⟦fbba193a5⟧ Ada Source

    Length: 5120 (0x1400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Moving_Guru_Rule, seg_02a478, separate Towers_Of_Hanoi_Rules_For_Graphic

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 Towers_Of_Hanoi_Graphic;
use Towers_Of_Hanoi_Graphic;
separate (Towers_Of_Hanoi_Rules_For_Graphic)
package body Moving_Guru_Rule is

    function Premiss return Join_Descriptor is
        The_Priority    : constant Alias := Alias'(P);
        The_Source      : constant Alias := Alias'(S);
        The_Destination : constant Alias := Alias'(D);
        The_Level       : constant Alias := Alias'(L);
    begin
        return (Movements.Exist ((Count      => Is_Equal (1),
                                  Priority   => Say_It_Is (The_Priority),
                                  From_Tower => Say_It_Is (The_Source),
                                  To_Tower   => Say_It_Is (The_Destination))),

                Towers.Exist ((Location   => Is_Equal (The_Source),
                               Disk_Count => Is_Greater (0) and
                                                Say_It_Is (The_Level))),

                Towers.Exist ((Location   => Is_Equal (The_Destination),
                               Disk_Count => Is_Any)),

                Disks.Exist ((Tower => Is_Equal (The_Source),
                              Level => Is_Equal (The_Level),
                              Size  => Is_Any)),

                Movements.Absent ((Priority => Is_Greater (The_Priority),
                                   From_Tower | To_Tower | Count => Is_Any)));
    end Premiss;

    procedure Action (The_Facts : Fact.Collection) is
        The_Movement    : Fact.Name renames The_Facts (1);  
        The_Source      : Fact.Name renames The_Facts (2);  
        The_Destination : Fact.Name renames The_Facts (3);  
        The_Disk        : Fact.Name renames The_Facts (4);
        The_Disk_Count  : Natural;
    begin
        The_Disk_Count := Towers.Get (The_Source, Disk_Count);
        Towers.Change (The_Source, Disk_Count, The_Disk_Count - 1);
        Delete_Disk (For_Needle => Towers.Get (The_Source, Location),
                     The_Disk   => Disks.Get (The_Disk, Level),
                     Its_Size   => Disks.Get (The_Disk, Size));

        The_Disk_Count := Towers.Get (The_Destination, Disk_Count);
        Towers.Change (The_Destination, Disk_Count, The_Disk_Count + 1);
        Print_Disk (For_Needle => Towers.Get (The_Destination, Location),
                    The_Disk   => The_Disk_Count + 1,
                    Its_Size   => Disks.Get (The_Disk, Size));

        Disks.Change (The_Disk, Tower, Towers.Get (The_Destination, Location));
        Disks.Change (The_Disk, Level, The_Disk_Count + 1);

        Movements.Delete (The_Movement);
        delay 0.8;

    end Action;

end Moving_Guru_Rule;


E3 Meta Data

    nblk1=4
    nid=0
    hdr6=8
        [0x00] rec0=16 rec1=00 rec2=01 rec3=082
        [0x01] rec0=01 rec1=00 rec2=04 rec3=008
        [0x02] rec0=14 rec1=00 rec2=03 rec3=04e
        [0x03] rec0=13 rec1=00 rec2=02 rec3=000
    tail 0x2152259a683e24dc37ca3 0x42a00088462063c03