[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Users-prolog Digest, Vol 58, Issue 1
From: |
Duncan Patton a Campbell |
Subject: |
Re: Users-prolog Digest, Vol 58, Issue 1 |
Date: |
Thu, 10 Jan 2008 13:07:23 -0600 |
On Thu, 10 Jan 2008 12:00:34 -0500
address@hidden wrote:
> Send Users-prolog mailing list submissions to
> address@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.gnu.org/mailman/listinfo/users-prolog
> or, via email, send a message with subject or body 'help' to
> address@hidden
>
> You can reach the person managing the list at
> address@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Users-prolog digest..."
>
>
> Today's Topics:
>
> 1. help with proglod sort method (chasingamy)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 9 Jan 2008 00:41:25 -0800 (PST)
> From: chasingamy <address@hidden>
> Subject: help with proglod sort method
> To: address@hidden
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset=us-ascii
>
>
> Can somebody help me with this:
>
> I have a number of paths that represent a a maze eg:
>
> path(start, wall1).
> path(start, wall2).
>
> this means from start you can go to wall1 or wall2 each wall also has a
> sound level attched to it eg:
>
> sound(start,1).
> sound(wall1,2).
>
> the higher the number the close to the exit you are. My problem is i am
> trying to write prolog that will do a breadthfirst search to find the exit,
> I have this working (i think!) but i need to write a method that will sort
> the path in order of sound so in my search when i do sortPath(Paths,
> Results) it will go through and sort it for me.
>
> Any help at all would be excellent!
I'm not sure if this will help. It is a sort that
lets you sort on internal elements in a list. If
you select to sort on "X" it will use that element
from each list to do the sorting on.
%sorton(2,[[3,1,2],[2,2,2],[1,2,3]],X).
sorton(Ix,Lin,Lout):-!,
sroti(Ix,Lin,NLS),
sort(NLS),
desroti(NLS,Lout).
desroti([],[]):-!.
desroti([[_,O]|NLS],[O|LOUT]):-!,
desroti(NLS,LOUT).
sroti(_,[],[]):-!.
sroti(Ix,[In|Lin],[[InX,In]|Lout]):-
nth(Ix,In,InX),!,
sroti(Ix,Lin,Lout).
sroti(Ix,[In|Lin],[[0,In]|Lout]):-!,
sroti(Ix,Lin,Lout).
Dhu
> --
> View this message in context:
> http://www.nabble.com/help-with-proglod-sort-method-tp14707350p14707350.html
> Sent from the Gnu - Prolog - Users mailing list archive at Nabble.com.
>
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Users-prolog mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/users-prolog
>
>
> End of Users-prolog Digest, Vol 58, Issue 1
> *******************************************
>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Users-prolog Digest, Vol 58, Issue 1,
Duncan Patton a Campbell <=