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

⟦97fa36ee7⟧ TextFile

    Length: 7560 (0x1d88)
    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_New, Brick_New;

procedure Mise_En_Casier_M is

    package Bricks_And_Boxes is
        procedure Find_The_Bricks;
    end Bricks_And_Boxes;

    package body Bricks_And_Boxes is

-----------------------------------------------------------------------------
--          RULES
-----------------------------------------------------------------------------

--  Rule 1
------------
        function Match_1 (R : Robot_New.Object; B : Brick_New.Object)
                         return Boolean is
        begin
            return Robot_New.Is_The_Task
                      (Of_Robot => R, The_Task => Robot_New.Prendre) and then
                   not Robot_New.Is_Occupied (The_Robot => R) and then
                   Brick_New.Is_The_Place (Of_Brick => B,
                                           The_Place => Brick_New.Tas) and then
                   Brick_New.The_Greatest_On_Heap (Brick => B);
        end Match_1;

        function Rule_1 is new Tuplecollection.Join2 (Match_1);

        function Condition_Saisir return Tuplecollection.Object is
        begin
            return Rule_1 (Robot_New.All_Robots, Brick_New.All_Bricks);
        end Condition_Saisir;

        procedure Action_Saisir (Mg : Tuple.Object) is
            A_Robot, A_Brick : Reference;
        begin  
            A_Robot := Tuple.First (Mg);
            A_Brick := Tuple.Second (Mg);
            Brick_New.Modify (A_Brick, The_Place => Brick_New.Pince);
            Robot_New.Modify (A_Robot, The_Occupation => True);

            Put_Line ("RegleSaisir  : " & Robot_New.Name (A_Robot) &
                      " prend brique (" &
                      Integer'Image (Brick_New.Size (A_Brick)) & " / " &
                      Brick_New.Tcolor'Image (Brick_New.Color (A_Brick)) & ")");
        end Action_Saisir;

-----------------------------------------------------------------------------
--  Rule 2
------------
        function Match_2 (R : Robot_New.Object; B : Brick_New.Object)
                         return Boolean is
        begin
            return Robot_New.Is_The_Task
                      (Of_Robot => R, The_Task => Robot_New.Prendre) and then
                   Robot_New.Is_Occupied (The_Robot => R) and then
                   Brick_New.Is_The_Place (Of_Brick => B,
                                           The_Place => Brick_New.Pince);
        end Match_2;

        function Rule_2 is new Tuplecollection.Join2 (Match_2);

        function Condition_Tenir return Tuplecollection.Object is
        begin
            return Rule_2 (Robot_New.All_Robots, Brick_New.All_Bricks);
        end Condition_Tenir;

        procedure Action_Tenir (Mg : Tuple.Object) is
            A_Robot, A_Brick : Reference;
        begin  
            A_Robot := Tuple.First (Mg);  
            A_Brick := Tuple.Second (Mg);
            Robot_New.Modify (A_Robot, The_Task => Robot_New.Deposer);
            Put_Line ("RegleTenir   : " & Robot_New.Name (A_Robot) &
                      " tient brique (" &
                      Integer'Image (Brick_New.Size (A_Brick)) & " / " &
                      Brick_New.Tcolor'Image (Brick_New.Color (A_Brick)) & ")");
        end Action_Tenir;


-----------------------------------------------------------------------------
--  Rule 3
--------------
        function Match_3 (R : Robot_New.Object; B : Brick_New.Object)
                         return Boolean is
        begin
            return Robot_New.Is_The_Task
                      (Of_Robot => R, The_Task => Robot_New.Deposer) and then
                   Brick_New.Is_The_Place (Of_Brick => B,
                                           The_Place => Brick_New.Pince);
        end Match_3;
        function Rule_3 is new Tuplecollection.Join2 (Match_3);

        function Condition_Caser return Tuplecollection.Object is
        begin
            return Rule_3 (Robot_New.All_Robots, Brick_New.All_Bricks);
        end Condition_Caser;

        procedure Action_Caser (Mg : Tuple.Object) is
            A_Brick, A_Robot : Reference;
        begin  
            A_Robot := Tuple.First (Mg);
            A_Brick := Tuple.Second (Mg);
            Robot_New.Modify (A_Robot, The_Task => Robot_New.Prendre);
            Robot_New.Modify (A_Robot, The_Box => Robot_New.Last_Box);
            Brick_New.Modify (A_Brick, The_Place => Brick_New.Boite);
            Brick_New.Modify (A_Brick,
                              The_Box => Robot_New.Box_Number (A_Robot));

            Put_Line ("RegleCaser   : " & Robot_New.Name (A_Robot) &
                      " depose brique (" &
                      Integer'Image (Brick_New.Size (A_Brick)) & " / " &
                      Brick_New.Tcolor'Image (Brick_New.Color (A_Brick)) &
                      ")" & " dans case " &
                      Integer'Image (Robot_New.Box_Number (A_Robot)));
            Put_Line (" ");

            Robot_New.Modify (A_Robot, The_Occupation => False);
        end Action_Caser;

-----------------------------------------------------------------------------
--  Rule 4
------------
        function Match_4 (B : Brick_New.Object) return Boolean is
        begin
            return Brick_New.Is_The_Place
                      (Of_Brick => B, The_Place => Brick_New.Tas);
        end Match_4;
        function Rule_4 is new Tuplecollection.Join1 (Match_4);

        function Condition_Arreter return Tuplecollection.Object is
        begin
            return Rule_4 (Robot_New.All_Robots);
        end Condition_Arreter;

        procedure Action_Arreter (Mgo : Tuple.Object) is
        begin
            Put_Line ("RegleArreter : Fin de recherche");
            Put_Line (" ");
        end Action_Arreter;

-----------------------------------------------------------------------------
        package Look_For_Bricks is new Engine (Context_Name => "BricAndBox",
                                               Resolution => Mea,
                                               Used_Rules => 4,
                                               Name_1 => "saisir         ",
                                               Condition_1 => Condition_Saisir,
                                               Action_1 => Action_Saisir,
                                               Name_2 => "tenir          ",
                                               Condition_2 => Condition_Tenir,
                                               Action_2 => Action_Tenir,
                                               Name_3 => "caser          ",
                                               Condition_3 => Condition_Caser,
                                               Action_3 => Action_Caser,
                                               Name_4 => "arreter        ",
                                               Condition_4 => Condition_Arreter,
                                               Action_4 => Action_Arreter);



        procedure Find_The_Bricks is
            Result : Boolean;
        begin
            Put_Line ("-------------------------------------------------");
            Robot_New.Create;
            Brick_New.Create;
            Result := Look_For_Bricks.Inference (Any);
            Put_Line ("-------------------------------------------------");
        end Find_The_Bricks;
    end Bricks_And_Boxes;

begin

    Debugger.Resetdebug (Debugger.Text);
    Debugger.Setdebugon (Debugger.Completly);
    Debugger.Refreshdebug;
    Debugger.Setdebugoff (Debugger.Conditionevalued);

    Bricks_And_Boxes.Find_The_Bricks;

end Mise_En_Casier_M;