swarm-support
[Top][All Lists]
Advanced

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

Re: Heatbug question...


From: Tony Bigbee
Subject: Re: Heatbug question...
Date: Sat, 23 Aug 1997 15:15:15 -0400

> From: address@hidden
> To: address@hidden
> Subject: Heatbug question...
> Date: Friday, August 22, 1997 4:19 PM
> All,
> What erases the heatbug pixmaps (or colored dots), each step?  I think
one
> reason might be that Im using a Discrete2d space, instead of the Diffuse
> Space...


Here's what I did to display a discrete 2d world inhabited by various
agents.  In my observerswarm.m :

-buildObjectsArgc: (int) argc Argv: (char**) argv {
 
  if (![super buildObjectsArgc: argc Argv: argv]) return self;
 
  unhappyGraph = [EZGraph createBegin: [self getZone] ];
  
  [unhappyGraph setTitle: "classifiers"];
  [unhappyGraph setAxisLabelsX: "time" Y: "value"];
  unhappyGraph = [unhappyGraph createEnd];

  [unhappyGraph createSequence: "strength"
  withFeedFrom: self andSelector:  M( averageStrength )];  
  [unhappyGraph createSequence: "payoffs"
  withFeedFrom: [classifierSystem getEnviron]
  andSelector:  M( getLastPeriodPayoff)];
  
  //  create and set the colormap, RGB values range from 0 to 1
  //0=black, 1=blue, 2=red, 3=green
  colormap = [XColormap create : [self getZone]];
  [colormap setColor: 0 ToRed: 0 Green: 0 Blue: 0];
  [colormap setColor: 1 ToRed: 0 Green: 0 Blue: 1];
  [colormap setColor: 2 ToRed: 1 Green: 0 Blue: 0];
  [colormap setColor: 3 ToRed: 0 Green: 1 Blue: 0];
 
  // create the 2d window
  worldRaster = [ZoomRaster create: [self getZone]];
  [worldRaster setColormap: colormap];
  [worldRaster setZoomFactor: 2];
  [worldRaster setWidth: 100 Height: 100];
  [worldRaster setWindowTitle: " Interworld"];
  [worldRaster pack];

  // create the object2dDisplay + raster for the stationary agents
  agentsDisplay = [Object2dDisplay createBegin: [self getZone]];
  [agentsDisplay setDisplayWidget : worldRaster];

  agentSpace = [ (id)[classifierSystem getEnviron] getWorld];
  agentStationaryList = [ (id)[classifierSystem getEnviron]
getstaAgentList];
  [agentsDisplay setDiscrete2dToDisplay: agentSpace];
  [agentsDisplay setDisplayMessage: M(drawSelfOn:)];
  
  theCasAgent = [ (id)[classifierSystem getEnviron] getCasAgent];
  [casAgentDisplay setDiscrete2dToDisplay: agentSpace];
  // [casAgentDisplay setObjectCollection: theCasAgent];
  [casAgentDisplay setDisplayMessage: M(drawSelfOn:)];

  [worldRaster setButton: ButtonLeft Client: agentsDisplay Message:
M(makeProbeAtX:Y:)];

  return self;
}

-customActions {
  [super customActions];
  [displayActions createActionTo: unhappyGraph message: M(step)];
  [displayActions createActionTo: worldRaster  message: M(erase)];
  [displayActions createActionTo: agentsDisplay  message: M(display)];
  [displayActions createActionTo: casAgentDisplay message: M(display)];
  [displayActions createActionTo: worldRaster  message: M(drawSelf)];
  
  return self;
}

I'm guessing that the diffuse space simply steps through every position in
the lattice for each simulation step and draws something.   In my case,
each agent (from a list of "stationary" agents), and the one mobile agent
draw themselves on the raster, and that's it.  

Tony Bigbee

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