lists

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


Date: Thu, 29 Apr 2004 02:24:02 +1000

Hi,

I am having a problem with this procedure and would appreciate your help.

select_action (CurrentLocation,Intentions,ActionSelected)

Current location will be a singleton list containing one actom of the
Agent's location. at(X,Y)

Then, the Intentions is a list of item (each item is represented as
item(X,Y,S). X and Y denotes the location (grid) of the item and S is the
value of item.)

What I want as an output here is an ActionSelected.
There are three types of action the agent can execute in any one cycle:

  a.. null - the agent does nothing
  b.. takes(X,Y) - the agent takes the item at (X,Y) and gains the
associated score (S)
  c.. move(X,Y) - the agent moves to the location (X,Y)
The item selected by the agent will be the first on the list of Intentions.
If it is "move" action, the action should also specify the coordinates to
which the agent should move (one square from the current location
(CurrentLocation -at(X,Y))

Assume that there is no obstacles in the path so any path is fine towards
the item (the path that agent takes towards the item does not matter). I
will be using Manhattan distance as below

% 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.

Please help me with the simplest algorithms to implement this problem. How
can I implement recursion in prolog in this context?

Thanks.

Love,
Neil



Relevant Pages

  • Re: lists
    ... > The item selected by the agent will be the first on the list of Intentions. ... (one square from the current location ... > % Manhattan distance between two squares ...
    (comp.lang.prolog)
  • need help for this procedure
    ... The goal selected by the agent is the first on the list of ... intentions, and in the case of a move action, the action should specify the ... The agent's goals at any time are a list of locations of items and their ... How could I implement this using lists in prolog? ...
    (comp.lang.prolog)
  • Tileworld Game
    ... descriptionis about Tileworld and only one agent is invloved. ... eats a piece of food by moving to its location and executing an eat action. ... However, once a goal is incorporated into the list of intentions, it ... compute the lists of beliefs and intentions resulting from the agent's ...
    (comp.lang.prolog)
  • Re: lists
    ... The goal selected by the agent is the first on the list of ... intentions, and in the case of a move action, the action should specify the ... The agent's goals at any time are a list of locations of items and their ... to the agent's current position (closer items coming earlier in the list). ...
    (comp.lang.prolog)