3 input lists - 1 modified output list

From: Neil York Oliver (neilyork82_at_yahoo.com)
Date: 04/28/04


Date: Thu, 29 Apr 2004 02:45:00 +1000

Hi,
I am trying to write a procedure that has four arguments. Please help me
with this problem.

MyCase(A,B,C,D)
A is a list of options (each of the form is aa(X,Y,S).

B is a list of locations (It only contains one atom of the form bb(X,Y).

C is a list of intentions (each of the form is aa(X,Y,S).

D is the required result(output) that should return the modified list of
intentions (adding new options (aa(X,Y,S)) into the existing list of
intentions). If a new option is the same distance from it as an existing one
(aa(X,Y,S)), then the new option is added later in the modified list.

Thanks. What will be the best algorithm?

Regards,
Joe

PS.

To make it easier,

new options will be inserted into the current list in order of Manhattan
distance of the goal(aa(X,Y,S)) from the ((agent's)) current location.

% Manhattan distance between two squares

distance((X,Y), (X1,Y1), D) :-
   dif(X, X1, Dx),
   dif(Y, Y1, Dy),
   D is Dx + Dy.

% D is |A - B|
dif(A, B, D) :-
   D is A - B, D >= 0, !.

dif(A, B, D) :-
   D is B - A.



Relevant Pages

  • Re: Fast LOS algorithm
    ... coordinates] are all dequed (with light passed through to squares at L1 distance ... distance n+1 are dequed. ... I don't see a material space wastage from two queues instead of one, ... excuse to store the manhattan distance with the square. ...
    (rec.games.roguelike.development)
  • got stuck
    ... in iprolog), I ... to distance predicate. ... a list of options each of the form goal, a list of beliefs ... intentions each of the form goal, and computes a list which contains ...
    (comp.lang.prolog)
  • output **no Whats wrong here?
    ... It just outputs **no and I can't trace or find the error for many hours. ... incorporate_intentions(Options, Beliefs, Intentions, Intentions1) which has ... ORDER) in order of the Manhattan distance of the goal from the agent's ...
    (comp.lang.prolog)
  • Re: Sean Pitman: definitions wanted
    ... And a basic theorem about random walks states that ... distance as well - since Manhattan distance is at least Euclidean ...
    (talk.origins)
  • Re: metric or measure?
    ... > In Euclidean space, the ... In Euclidean 2-space, the distance ... > There are other metrics. ... (Manhattan distance is an instance of this more general notion, ...
    (alt.usage.english)