swarm-support
[Top][All Lists]
Advanced

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

address@hidden ask


From: Marcus G. Daniels
Subject: address@hidden ask
Date: 14 Dec 2001 09:10:16 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.7


--- Begin Message --- Subject: ask Date: Fri, 14 Dec 2001 23:23:30 +0800 (CST)
  Dear Marcus G. Daniels:

 Thank you very much for your code in Java to help me.
Unfortunately,I have never learned java and I use Swarm
in Objective C.I plan to learn java next year.Now I am 
trying to understand the java code meaning you wrote.
 Anyway, thank you again.
 I got an idea from your first e-mail and wrote a program
to test it, but I was unluky. I just want to many bugs can
enter into a running Swarm continuously.
Part code in bug.m is:

- add
{
  Bug *newBug; 
  int newX = 0, newY = 0;
  
  newBug = [Bug createBegin: self];
  [newBug setModelSwarm: bugModelSwarm World: world  BugSpace: bugspace];
  newBug = [newBug createEnd];  
  
  do
    {
      newX = [uniformIntRand getIntegerWithMin: 0 withMax: worldXSize];
      newY = [uniformIntRand getIntegerWithMin: 0 withMax: worldXSize];

      newX = (newX + worldXSize) % worldXSize;
      newY = (newY + worldYSize) % worldYSize;  
    } while([world getObjectAtX: newX Y: newY] != nil);  
  
 [world putObject: newBug atX: newX Y: newY];          
  [newBug setX: newX Y: newY];
  [[bugModelSwarm getBugList] addLast: newBug];
  return self;        
}
 
 Where bugModelSwarm is passed from ModelSwarm itself.
 There is something wrong about my code I guess. 
 Could you help me to correct it?

 Best regards!

 Paul Snow
 address@hidden
 Dept. Urban & Environment Sciences
 Peking U.
 Beijing, China
 Tel:86-010-62761804









--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]