|
|
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: 2749 (0xabd)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
└─⟦d65440be7⟧ »DATA«
└─⟦this⟧
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦e24fb53b7⟧
└─⟦this⟧
separate (Towers_Of_Hanoi_Rules_For_Benchmark)
package body Reformulating_Guru_Rule is
Decision_Table : constant array (1 .. 3, 1 .. 3) of Integer :=
(1 => (3, 3, 2), 2 => (3, 3, 1), 3 => (2, 1, 1));
function Other_Tower_Than
(First, Second : Slot.Object) return Slot.Object is
Result : Integer;
begin
Result := Decision_Table (Slot.Get (First), Slot.Get (Second));
return Slot.Value (Result);
end Other_Tower_Than;
function More_Urgent (Than : Slot.Object) return Slot.Object is
use Slot.Operators;
begin
return Than + Slot.Value (1);
end More_Urgent;
function Premiss return Fact_Queries is
The_Priority : constant Alias.Name := Alias.P;
begin
return (Movements.Exist ((Count => Is_Greater (1),
Priority => Define_As (The_Priority),
From_Tower | To_Tower => 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, The_Destination, The_Count, The_Priority : Slot.Object;
Move_First, Move_Second, Move_Third : Slot.Object;
The_Other_Tower : Slot.Object;
One : constant Slot.Object := Slot.Value (1);
use Slot.Operators;
begin
The_Source := Movements.Get (The_Movement, From_Tower);
The_Destination := Movements.Get (The_Movement, To_Tower);
The_Count := Movements.Get (The_Movement, Count);
The_Priority := Movements.Get (The_Movement, Priority);
Move_Third := More_Urgent (Than => The_Priority);
Move_Second := More_Urgent (Than => Move_Third);
Move_First := More_Urgent (Than => Move_Second);
The_Other_Tower := Other_Tower_Than (The_Source, The_Destination);
Movements.Add ((Priority => Move_First,
From_Tower => The_Source,
To_Tower => The_Other_Tower,
Count => The_Count - One));
Movements.Add ((Priority => Move_Second,
From_Tower => The_Source,
To_Tower => The_Destination,
Count => One));
Movements.Add ((Priority => Move_Third,
From_Tower => The_Other_Tower,
To_Tower => The_Destination,
Count => The_Count - One));
Movements.Delete (The_Movement);
end Action;
end Reformulating_Guru_Rule;