//Marcus Daniels swarm-support 1-29-00 //KR> Can anyone show me the way to //KR> sourcecode that uses EZBin and is available in the internet? //With 2.0.1 you'd get an OffsetOutOfRange error if you changed //"#if 1" below to "#if 0". That won't happen if you update your //$SWARMHOME/bin/swarm.dll to the one in //ftp://ftp.santafe.edu/pub/swarm/2.0.1-fixes. #import #import #import #import @interface Agent: CreateDrop { double value; } - setAgentValue: (double)value; - (double)getAgentValue; @end @implementation Agent - setAgentValue: (double)theValue { value = theValue; return self; } - (double)getAgentValue { return value; } @end @interface ObserverSwarm: GUISwarm { id schedule; id graph; id list; } - createEnd; - buildActions; - step; @end @implementation ObserverSwarm #define AGENT(val) [[[Agent createBegin: globalZone] setAgentValue: val] createEnd] - createEnd { [super createEnd]; list = [List create: globalZone]; #if 1 [list addLast: AGENT (1.0)]; [list addLast: AGENT (2.0)]; [list addLast: AGENT (3.0)]; #endif graph = [EZBin createBegin: globalZone]; [graph setTitle: "EZBin"]; [graph setAxisLabelsX: "X label" Y: "Y label"]; [graph setBinCount: 10]; [graph setLowerBound: 0]; [graph setUpperBound: 5]; [graph setCollection: list]; [graph setProbedSelector: M(getAgentValue)]; graph = [graph createEnd]; return self; } - buildActions { schedule = [[[Schedule createBegin: self] setRepeatInterval: 1] createEnd]; [schedule at: 0 createActionTo: self message: M(step)]; return self; } - step { [graph reset]; [graph update]; [graph output]; [actionCache doTkEvents]; return self; } - activateIn: swarmContext { [super activateIn: swarmContext]; [schedule activateIn: self]; return [self getActivity]; } @end int main (int argc, const char **argv) { id observerSwarm; initSwarm (argc, argv); observerSwarm = [ObserverSwarm create: globalZone]; [observerSwarm buildObjects]; [observerSwarm buildActions]; [observerSwarm activateIn: nil]; [observerSwarm go]; return 0; } /* Local Variables: compile-command: "$SWARMHOME/bin/libtool-swarm --mode=link gcc -o ezbin -Wall -Werror -g -Wno-import -I$SWARMHOME/include -L$SWARMHOME/lib ezbin.m -lswarm -lobjc" End: */