[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: communication between agents
From: |
Paul E. Johnson |
Subject: |
Re: communication between agents |
Date: |
Tue, 11 Apr 2000 08:44:31 -0500 |
iwata wrote:
>
> Dear everybody,
>
> I am a new comer for this list and multi-agent field.
> I would like some agents to communicate. For example,
> Bug1 says "I am hungry," and
> Bug2 responds to Bug1 "I found food at site A."
I think there is an example like that in the HelloWorld app in the
swarmapps package.
If I were doing this, here is what I'd do. I'd probably create a class
to old the message. Suppose it is called Mesg. That class is created
in case I need to pass complicated information, such as several
coodrdinates.
In your bug class, write methods like
- receiveMessage: (Mesg*) x;
The body of the sendMessage has
- sendMessage: (Mesg*) x To: (Mesg*) y;
{
[y receiveMessage: x];
return self;
}
The receiveMessage method has stuff to get the information out of the
Mesg object and decide what to do
--
Paul E. Johnson email: address@hidden
Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn
University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66045 FAX: (785) 864-5700
==================================
Swarm-Modelling is for discussion of Simulation and Modelling techniques
esp. using Swarm. For list administration needs (esp. [un]subscribing),
please send a message to <address@hidden> with "help" in the
body of the message.
==================================