|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 4039 (0xfc7)
Types: TextFile
Names: »B«
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
└─⟦6f12a12be⟧ »DATA«
└─⟦this⟧
with Bbr_Kbs;
with Bbr_Attributes;
with Bbr_Frames;
with Output_Stream;
use Bbr_Kbs, Bbr_Attributes, Bbr_Frames;
use Output_Stream;
package body Bbr_General_Bundle is
use Kbs;
use Kbs.Expression;
use Kbs.System_Defined_Expression;
type Rule_Names is (Pair_Ball_And_Boxes, Remove_The_Robots, No_More);
-------------------------------------------------------------------------------
package Pair_Ball_And_Boxes_Rule is
function Premiss return Fact_Base.Queries;
procedure Action (The_Pair : Fact_Base.Collection);
end Pair_Ball_And_Boxes_Rule;
package body Pair_Ball_And_Boxes_Rule is
function Premiss return Fact_Base.Queries is
begin
return (Balls.Exist ((Size => Define_As (S),
Colour => Define_As (C),
Place => Is_Equal (On_Heap))),
Boxes.Exist ((Colour => Is_Equal (C),
Size => Define_As (T) and Is_Greater (S),
State => Is_Equal (Free))),
Boxes.Absent ((Colour => Is_Equal (C),
Size => Is_Less (T) and Is_Greater (S),
State => Is_Equal (Free))));
end Premiss;
procedure Action (The_Pair : Fact_Base.Collection) is
The_Ball : Fact_Base.Object renames The_Pair (1);
The_Box : Fact_Base.Object renames The_Pair (2);
begin
New_Line (Standard_Output);
Put_Line ("----- Pair_Ball_And_Boxes -----", Standard_Output);
New_Line (Standard_Output);
Put ("The ball : ", Standard_Output);
Balls.Put (The_Ball, Standard_Output);
New_Line (Standard_Output);
Put ("Has been paired with : ", Standard_Output);
Boxes.Put (The_Box, Standard_Output);
Balls.Change (The_Ball, Place, To_Value => In_Box);
Boxes.Change (The_Box, State, To_Value => Busy);
end Action;
end Pair_Ball_And_Boxes_Rule;
-------------------------------------------------------------------------------
package Remove_The_Robots_Rule is
function Premiss return Fact_Base.Queries;
procedure Action (Objects : Fact_Base.Collection);
end Remove_The_Robots_Rule;
package body Remove_The_Robots_Rule is
function Premiss return Fact_Base.Queries is
begin
return (1 => (Robots.Exist ((Colour => Is_Equal (Red),
State => Is_Equal (Busy)))));
end Premiss;
procedure Action (Objects : Fact_Base.Collection) is
The_Fact : Fact_Base.Object renames Objects (1);
use Output_Stream;
begin
New_Line (Standard_Output);
Put_Line ("----- Remove_The_Red_Robots -----", Standard_Output);
New_Line (Standard_Output);
Put ("Removing : ", Standard_Output);
Robots.Put (The_Fact, Standard_Output);
Robots.Delete (The_Fact);
end Action;
end Remove_The_Robots_Rule;
-------------------------------------------------------------------------------
package Rule_Bundle is
new Rule_Base.Generic_Rule_Bundle
(The_Bundle => Bbr_Kbs.Bbr_General_Bundle,
Rule_Names => Rule_Names,
Nothing => Rule_Names'(No_More),
Rule_1 => Pair_Ball_And_Boxes,
Premiss_1 => Pair_Ball_And_Boxes_Rule.Premiss,
Action_1 => Pair_Ball_And_Boxes_Rule.Action,
Rule_2 => Remove_The_Robots,
Premiss_2 => Remove_The_Robots_Rule.Premiss,
Action_2 => Remove_The_Robots_Rule.Action);
procedure Do_Action (For_Rule : Rule_Base.Rule_Id;
On_Facts : Fact_Base.Collection) is
begin
Rule_Bundle.Do_Action (For_Rule, On_Facts);
end Do_Action;
end Bbr_General_Bundle;