Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find minimum

Status
Not open for further replies.

sta7mor

Programmer
Oct 1, 2007
1
GR
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top