


Replace_fluent(S1, door(R1-R2, unlocked), % If Robbie is carrying something, it moves too % Robbie is in the car with the vacuum-cleaner % Only if it's locked, robbie has the key % and robbie is in L (location(X, L) is implicit) % If robbie is holding X, it belongs in L % If robbie is in the same place as X and not % If robbie is in X and the door is unlocked % - put_away(Item) % the tidy version of drop % Utility to replace a fluent in the Situation Ground(Fluent), ord_memberchk(Fluent, Situation), !. % This is the query mechanism for Situations % Does a fluent hold (is true) in the Situation? % Nothing to doĮxecute_process(S1,, S2) :. % Take a list of Actions and execute themĮxecute_process(S1,, S1).

% s0, the initial situation, is the (ordered) set We don't want to encode every possible node and edge, so we'll encode these as rules.įluent(location(vacuum-cleaner, kitchen)). We have actions that connect these states, they're possible in some states and result in others. We have states of the world, which are comprised of fluents (things that change value between states).
#BLOCK WORLD PROBLEM IN PROLOG CODE#
But Robbie's owner, who likes things clean and tidy, also expects everything returned to its proper place with doors locked before they wake up.įor this to work we need to describe the world in a suitable manner so that we can use A*, then we'll need to code A* and run it to obtain a plan. To do this it'll need to unlock and open the door to the garage, unlock and open the car door, take the vacuum to the car and use it. Robbie the one-handed robot is in a hurry, it needs to vacuum the car before its owner goes to work. We can use it for planning by considering a state of the world as a node and an action as an edge transitioning between nodes. Author: Paul Brown is a search algorithm using a heuristic to improve efficiency for most cases.
