So based on what you have said so far the following two predicates are required to be used.
in_shape(pos(Line,Column), shape(square,Dimension)) :-
%les position doivent etre > 0.
positif_position(pos(Line, Column)),
%verifications des positions et de la dimension
Dimension >= 0,
Line =< Dimension,
Column =< Dimension,
%optionnel?
shape(square,Dimension).
%Movments in a room.
move((state(pos(Line ,Column ), room(Index, shape(Shape ,Dimension )), item(TheItem ))),
(state(pos(Line2,Column2), room(Index2, shape(Shape2,Dimension2)), item(CollectedItem))),
TimeSpent,Time) :-
%Verify if the movement is done in the same room
%If the index of the room is different, then there is a portal???
Index =:= Index2, Shape =:= Shape2, %this might change
%Verify if the resulting position of the movement is in the shape.
in_shape(pos(Line2,Column2), shape(Shape2,Dimension)),
%Definition of possible movements
Right is Column+1,
Left is Column-1,
Up is Line+1,
Down is Line-1,
%This is an if else statement inside another one.
%If the item is a diagonalizer, then we can move in diag,
%CollectedItem is a diagonaliser and Time remains unchanged.
%else, we cant move in diag, CollectedItem is nothing and Time
%is Time+1.
(
item(TheItem)
->
CollectedItem = diagonalizer,
Time is TimeSpent,
member(Line2,[Up,Down]),
member(Column2,[Left,Right])
; %else
CollectedItem = nothing,
Time is TimeSpent+1,
(
Column=:=Column2
->
member(Line2,[Up,Down])
;
Line2=:=Line,
member(Column2,[Left,Right])
)
).
Are these predicates as listed above the way they were given? Did you add the comments?
Also the names of the variables to not follow the standard convention. When a variable represents the same thing going in an and out but changes in the predicate the standard is to name the incoming argument with an ending 0, the outgoing argument with no number and increment the ending number as the argument changes in the predicate.