swarm-support
[Top][All Lists]
Advanced

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

Re: How to eat, how communicate.


From: Marcus G. Daniels
Subject: Re: How to eat, how communicate.
Date: 23 Feb 2001 15:08:59 -0800
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "JM" == Jacobo Myerston <address@hidden> writes:

JM> How can an agent take energy from another agent and how can a
JM> agent see other agents performing rituals and interpret these
JM> rituals as messages. In my world ritual should be a form of
JM> communication.

Perhaps taking energy means encouraging an affinity toward a desired
pattern of behavior, and that this manipulation is done through
rituals? 

I suppose you realize that you have to be really careful about
defining `energy' in a global way since that could bias the whole
model toward an imaginary thing that nobody experiences in the same
way, and that doesn't exist above and beyond observed behavior.

Anyway, as for technically how to implement these kinds of
transactions, one idea would be to have a message buffer or schedule
that performers could fill with different orderings.
Then you'd need some way to identify performers within range.

The former could be done by having a one or more ForEach Actions in
the performer, where interested listeners would request to be added to
the various ForEach list by sending a message to the performer.
(Different Actions might be different notes in a song at different
times.)

The latter could be done by providing an abstract Agent type from which all
agents inherit that has a getNeighbor method that hides agent
decision making from awareness of space.  I.e. each agent would have a
hidden reference to the grid, but would not otherwise know about
absolute position (except in getNeighbor).  getNeighbor might randomly
select one of several individuals within range, or, alternatively
return a list.

Note that in Swarm, messages are distinct from [agent] types.  This is
realizing that the real world is a confusing and violent place, and
that performers may well say things that make no sense to certain
listeners.  Modeling, like programming, often means dealing with a lot
of unexpected situations.

Btw, because Swarm Actions are issued by the Objective C runtime, it is 
possible to completely detach Java methods from receiving objects
(i.e. rituals from their meaning), and trap the cases where a message
is nonsensical.  Guess what, evolution is not strongly typed!

$ cat NoSelector.java
import swarm.Globals;
import swarm.Selector;
import swarm.objectbase.SwarmObjectImpl;

class Agent extends SwarmObjectImpl {
}

class Insider extends Agent {
  public Object frob () {
    System.out.println ("frob");
    return this;
  }
}

class Outsider extends Agent {
  public void doesNotRecognize (Selector sel) {
    System.out.println ("ouch! " + sel);
  }
}

public class NoSelector {
  static void main (String args[]) {
    Globals.env.initSwarm ("NoSelector", "address@hidden", "0.0", args);
  
    Agent insider = new Insider ();
    Agent outsider = new Outsider ();
    Selector sel = null;

    try {
      sel = new Selector (insider.getClass (), "frob", false);
    } catch (Exception e) {
      e.printStackTrace (System.err);
      System.exit (1);
    }
    insider.perform (sel);
    outsider.perform (sel);
  }
}
$ javaswarm NoSelector --version
NoSelector address@hidden (Swarm 2001-02-23)
$ javaswarm NoSelector          
frob
ouch! address@hidden

                  ==================================
   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]