(1) | %Action definition | (2) | action (X, X, none):- isPlace (X). | (3) | action (X, Y, cd):- room (X), room (Y), X\ = Y. | (4) | action (X, Y, fc):- cross (X), cross (Y), X\ = Y. | (5) | action (X, Y, fc):- door (X), door (Y), X\ = Y. | (6) | action (X, Y, fc):- interior (X), interior (Y), X\ = Y. | (7) | action (X, Y, cd):- room (X), door (Y), not (closed (Y)), X\ = Y. | (8) | action (X, Y, fc):- room (X), interior (Y), X\ = Y. | (9) | action (X, Y, fc):- cross (X), door (Y), X\ = Y. | (10) | action (X, Y, cd):- door (X), not (closed (X)), interior (Y), X\ = Y. | (11) | %Know if X is an existing place | (12) | isPlace (X):- room (X). | (13) | isPlace (X):- door (X). | (14) | isPlace (X):- interior (X). | (15) | isPlace (X):- cross (X). | (16) | %Action rules than ensures reversibility | (17) | isAction (X, X, Action):- action (X, X, Action). | (18) | isAction (X, Y, Action):- action (X, Y, Action), X\ = Y, !. | (19) | isAction (X, Y, Action):- action (Y, X, Action), X\ = Y, !. |
|