Hi. I am new to prolog and this is my first post. I think it is an amazing language, and its diffuculty lies in simple thinking. What i want to ask is:
I have a project in a post graduate course of a robot moving on a squared map. The robot shall be receiving directions, and it will move that way. There is a certain predicate "decide_move" which decides the best direction, concerning some criteria:
decide_move(X,Y,NX,NY,C):-
new_location(X,Y,NX,NY,_),
mapxy(NX,NY,Element),
cost(Element,C),
C < 4.
This gives me several cases of C. How could i find the minimum of these values? I thought of putting the results in a list, and then find the minimum, but even that, I don't know how to do it, and also there must be an easier way.
Does anyone have any idea?
Thanx alot.
I have a project in a post graduate course of a robot moving on a squared map. The robot shall be receiving directions, and it will move that way. There is a certain predicate "decide_move" which decides the best direction, concerning some criteria:
decide_move(X,Y,NX,NY,C):-
new_location(X,Y,NX,NY,_),
mapxy(NX,NY,Element),
cost(Element,C),
C < 4.
This gives me several cases of C. How could i find the minimum of these values? I thought of putting the results in a list, and then find the minimum, but even that, I don't know how to do it, and also there must be an easier way.
Does anyone have any idea?
Thanx alot.