DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦81510fa41⟧ TextFile

    Length: 7147 (0x1beb)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Expertsystem;
use Expertsystem;
with Robot, Brique;
use Robot, Brique;
procedure Mise_En_Casier_1 is

    package Robotetbrique is
        procedure Miseenboite;
    end Robotetbrique;

    package body Robotetbrique is

        Casier : Natural := 0;

        function Peutmettreenboite return Boolean is
        begin
            Regle_Saisir_Tenir:
                --  (classe => robot,  tache => prendre)
                --  (classe => brique, lieu  => tas,   taille=> <x> )
                -- !(classe => brique, lieu  => tas,   taille=> (> <x>))
                --------------------------------------------------------
                declare
                    Rb : Tuple.Object;
                    Unebrique, Unrobot : Reference;

                    function Match (R, B : Reference) return Boolean is
                    begin
                        return Peutprendre (R) and then
                                  not Tientbrique (R) and then
                                  Surtas (B) and then Laplusgrandedutas (B);
                    end Match;

                    function Robotsaisir is new Tuplecollection.Join2 (Match);
                begin
                    Rb := Tuplecollection.First
                             (Robotsaisir (Lesrobots, Lesbriques));

                    if Tuple.Isnotnull (Rb) then
                        Unrobot := Tuple.First (Rb);
                        Unebrique := Tuple.Second (Rb);
                        Robot.Modifierpince (Unrobot, True);
                        Brique.Modifierlieu (Unebrique, Pince);
                        Robot.Modifiertache (Unrobot, Deposer);

                        Put_Line ("RegleSaisir : " & Robot.Nom (Unrobot) &
                                  " prend brique (taille=" &
                                  Integer'Image (Brique.Taille (Unebrique)) &
                                  " / couleur = " &
                                  Tcouleur'Image (Brique.Couleur (Unebrique)));
                        Put_Line (" ");

                        return True;
                    end if;
                end Regle_Saisir_Tenir;
            --
            -- Regletenir:
            --     --  (classe => robot,  tache => prendre)
            --     --  (classe => brique, lieu  => pince)
            --     --------------------------------------------
            --     declare
            --         Rb : Tuple.Object;
            --         Unrobot : Reference;
            --         Unebrique : Reference;
            --
            --         function Match (R, B : Reference) return Boolean is
            --         begin
            --             return Peutprendre (R) and then
            --                       Tientbrique (R) and then Danspince (B);
            --         end Match;
            --
            --         function Robottenir is new Tuplecollection.Join2 (Match);
            --
            --     begin
            --         Rb := Tuplecollection.First
            --                  (Robottenir (Lesrobots, Lesbriques));
            --
            --         if Tuple.Isnotnull (Rb) then
            --             Unrobot := Tuple.First (Rb);
            --             Unebrique := Tuple.Second (Rb);
            --             Robot.Modifiertache (Unrobot, Deposer);
            --
            --             Put ("RegleTenir : Le ");
            --             Put (Robot.Nom (Unrobot));
            --             Put (" va deposer la brique ");
            --             Put_Line (Tcouleur'Image (Brique.Couleur (Unebrique)));
            --             Put_Line (" ");
            --
            --             return True;
            --         end if;
            --     end Regletenir;
            --
            Reglecaser:
                --  (classe => robot, tache => deposer, case => <c>)
                --  (classe => brique, lieu => pince)
                ------------------------------------------------------
                declare
                    Rb : Tuple.Object;
                    Unebrique, Unrobot : Reference;

                    function Match (R, B : Reference) return Boolean is
                    begin
                        return Peutdeposer (R) and then Danspince (B);
                    end Match;

                    function Robotcaser is new Tuplecollection.Join2 (Match);

                begin
                    Rb := Tuplecollection.First
                             (Robotcaser (Lesrobots, Lesbriques));
                    if Tuple.Isnotnull (Rb) then
                        Unrobot := Tuple.First (Rb);
                        Unebrique := Tuple.Second (Rb);
                        Brique.Modifierlieu (Unebrique, Boite);
                        Robot.Modifiertache (Unrobot, Prendre);
                        Robot.Modifierboite (Unrobot, Robot.Derniereboite);
                        Brique.Modifierboite (Unebrique,
                                              Robot.Numeroboite (Unrobot));

                        Put ("RegleCaser : Le ");
                        Put (Robot.Nom (Unrobot));
                        Put (" depose la brique dans la case");
                        Put (Integer (Robot.Numeroboite (Unrobot)));
                        Put_Line (" ");

                        Robot.Modifierpince (Unrobot, False);
                        return True;
                    end if;
                end Reglecaser;

            Reglearreter:
                --  (classe => robot, tache => prendre)
                -- !(classe => brique, lieu => tas)
                -----------------------------------------
                declare
                    Rb : Tuple.Object;
                    Unrobot : Reference;

                    function Match (R, B : Reference) return Boolean is
                    begin
                        return Peutprendre (R) and then not Surtas (B);
                    end Match;

                    function Robotarreter is new Tuplecollection.Join2 (Match);

                begin
                    Rb := Tuplecollection.First
                             (Robotarreter (Lesrobots, Lesbriques));

                    if not Tuple.Isnull (Rb) then
                        Unrobot := Tuple.First (Rb);

                        Put ("RegleArreter : Le ");
                        Put (Robot.Nom (Unrobot));
                        Put_Line (" se suicide (plus de briques)");

                        Robot.Sesuicide (Unrobot);
                        return True;
                    end if;
                end Reglearreter;
            return False;
        end Peutmettreenboite;

        procedure Mettreenboite is
        begin
            loop
                exit when not Peutmettreenboite;
            end loop;
        end Mettreenboite;

        procedure Miseenboite is
        begin
            Robot.Creer;
            Brique.Creer;
            loop
                Mettreenboite;
                -- autres contextes a traiter
                exit;
            end loop;
        end Miseenboite;

    end Robotetbrique;


begin
    Robotetbrique.Miseenboite;
end Mise_En_Casier_1;