swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] (no subject)


From: Steve Railsback
Subject: Re: [Swarm-Support] (no subject)
Date: Tue, 13 Apr 2004 07:33:47 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)

address@hidden wrote:

> I'm using Swarm2.1.1 in Windows2000,programme with java. I have two
> questions:

These are some basic questions, and I can provide only basic answers.

> Globals.env.uniformIntRand.getIntegerWithMin$withMax(min,max) If we
> use this method to get an integer within min and max,though we cann't
> predict which value we will get,but it showed that every time you run
> the application include,it will return the same values.So it is not
> random,yes?

A random number distribution like uniformIntRand is attached to a random
number generator. (See "ProbabilityDistribution" in the Random library,
Swarm reference guide.) When the random number generator is created it
is given a seed (see "SingleSeed" in the reference guide). If you use
the same seed, the generator (and, therefore, the distribution) creates
the same sequence of random values.

If you want to run a model more than once and change only the random
number values, you must change the random number generator's seed.


> In the "jheatbugs2.1" example,if I want to destroy a Agent(i.e bug)
> from the heatbuglist,I detect one place to see if it has a bug in it
> using "if((world.getObjectAtX$Y(doorX,doorY))!=null)" ,if true,then I
> do two things: 
> "heatbugList.remove(world.getObjectAtX$Y(doorX,doorY));" and
> "world.putObject$atX$Y (null, doorX, doorY);". But I find myself
> wrong,and I don't know why. could you tell me? thanks. 

I'm not sure here exactly what you want, but remember that removing an
object from a collection such as a list or discrete2d does not destroy
the object. To destroy an object, you must remove it from all
collections it is in (as you seem to do here), then "drop" it.

-- 
Lang, Railsback & Associates
Arcata, CA
707 822 0453



reply via email to

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