swarm-support
[Top][All Lists]
Advanced

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

Re: Randomising ActionGroup


From: Marcus G. Daniels
Subject: Re: Randomising ActionGroup
Date: Thu, 25 Feb 1999 12:02:30 -0700 (MST)

AVK> If you've got a randomized ActionGroup working, could you please
AVK> send me an excerpt from your program which shows how to do it?

When there is a technical problem, excerpts are not that helpful
because they tend to reflect more the author's intent, and often, even
though the intent is reasonable, details or context are broken in some
obscure way.  Reproducability is God!

Makefile
--------
APPLICATION =test
OBJECTS=ActionGroupRandomized.o
include $(SWARMHOME)/etc/swarm/Makefile.appl

ActionGroupRandomized.o: ActionGroupRandomized.m


ActionGroupRandomized.m
---------
#import <simtools.h>
#import <activity.h>
#import <objectbase/SwarmObject.h>

@interface Responder: SwarmObject
{
}

- m1;
- m2;
- m3;
- m4;
- m5;

@end

@implementation Responder

- m1 
{
  printf ("m1\n");
  return self;
}

- m2 
{
  printf ("m2\n");
  return self;
}

- m3
{
  printf ("m3\n");
  return self;
}

- m4 
{
  printf ("m4\n");
  return self;
}

- m5 
{
  printf ("m5\n");
  return self;
}

@end

int 
main (int argc, const char ** argv)
{
  id actionGroupTest;
  id obj;

  initSwarmBatch (argc, argv);

  actionGroupTest = [ActionGroup createBegin: globalZone];
  obj = [Responder create: globalZone];

  [actionGroupTest setDefaultOrder: Randomized];
  actionGroupTest = [actionGroupTest createEnd];
  [actionGroupTest createActionTo: obj message: M(m1)];
  [actionGroupTest createActionTo: obj message: M(m2)];
  [actionGroupTest createActionTo: obj message: M(m3)];

  [[actionGroupTest activateIn: nil] run];
}


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