swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does the agent know other's information?


From: Rick Riolo
Subject: Re: How does the agent know other's information?
Date: Tue, 29 Jan 2002 06:24:35 -0500 (EST)

if i understand your question, then
building on the codes below, one could just do this:

  id otherBug;
  ...

  if ( (otherBug = [world getObjectAtX: newX Y: newY]) != nil ) ) {
      [otherBug getHaveEaten];
      ...
  }

assuming the Bug's have a getHaveEaten method, of course.

In general, the approach is to
   = get the address of the other object, by whatever
     is the approapriate/convenient scheme
   = send it a getXXX message to access its value for XXX

  - r

-- 
Rick Riolo                           address@hidden
Center for Study of Complex Systems (CSCS)
4477 Randall Lab                
University of Michigan         Ann Arbor MI 48109-1120
Phone: 734 763 3323                  Fax: 734 763 9267
http://www.pscs.umich.edu/PEOPLE/rlr-home.html

On Tue, 29 Jan 2002, Makoto Igarashi wrote:

> Date: Tue, 29 Jan 2002 17:42:04 +0900
> From: Makoto Igarashi <address@hidden>
> Reply-To: address@hidden
> To: address@hidden
> Subject: How does the agent know other's information?
> 
> Hi all,
> 
> 
> In Bug.m of simpleSwarmBug3, the agent can check whether other agent is 
> at (newX, newY) or not using below code,
> 
> [world getObjectAtX: newX Y: newY]
> 
> Using similar way, does the agent know other's information (for example, 
> the value of haveEaten)? Could anyone tell me the way or show me some 
> sample codes?
> 
> Any help would be greatly appreciated.
> 
> 
> Thanks,
> 
> 
> 
> --
> 
> _ Makoto Igarashi _____________________________________________________
> _ mailto:address@hidden
> _ http://urban.tutrp.tut.ac.jp/~igarashi/
> 
>                   ==================================
>    Swarm-Support is for discussion of the technical details of the day
>    to day usage of Swarm.  For list administration needs (esp.
>    [un]subscribing), please send a message to <address@hidden>
>    with "help" in the body of the message.
> 


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]