bass20
asked on
Prolog - Searching within a list of lists - how to do it
Hello,
I'm working on a program that lacks this one thing to be complete. :(
It's about a simple robot that cleans a room; the room is represented through a 10x10 map divided into squares, each square having it's own unique pair of x,y coordinates. I'm representing the coordinates via a list that contains two elements: [Xcoord,Ycoord], and a path through the room is represented via a sequence of squares in a list: [[0,0],[0,1][1,1]], for example. The robot doesn't move diagonally.
Now I need to find out how to get to a certain square being on another square; for example, I'm on [5,4] and I need to get to [0,0] - I need a predicate that returns me a list with a possible path through these squares, and I just can't do it :((( The closest I got didn't even work correctly. :(((( I know I could just subtract/sum the coordinates of the original position to get the result I want, but that's not what I need :(
Can someone please post some ideas, links and/or code examples on this?
Thanx in advance :)
I'm working on a program that lacks this one thing to be complete. :(
It's about a simple robot that cleans a room; the room is represented through a 10x10 map divided into squares, each square having it's own unique pair of x,y coordinates. I'm representing the coordinates via a list that contains two elements: [Xcoord,Ycoord], and a path through the room is represented via a sequence of squares in a list: [[0,0],[0,1][1,1]], for example. The robot doesn't move diagonally.
Now I need to find out how to get to a certain square being on another square; for example, I'm on [5,4] and I need to get to [0,0] - I need a predicate that returns me a list with a possible path through these squares, and I just can't do it :((( The closest I got didn't even work correctly. :(((( I know I could just subtract/sum the coordinates of the original position to get the result I want, but that's not what I need :(
Can someone please post some ideas, links and/or code examples on this?
Thanx in advance :)
ASKER
No Prolog there...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/phi3DGeom.html#fivereg
I've had use of this site before when it came to mathematical problems, maybe it will help you as well?
Good luck,
/B