[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Heatbug/Swarm style questions...
From: |
bleydorf |
Subject: |
Re: Heatbug/Swarm style questions... |
Date: |
Wed, 06 Aug 1997 16:54:11 -0400 |
Hi,
I resending this message since I hadn't heard back from anyone
(Ken)...Plus, I added some extra notes at the end of it...I have to have
this done by Friday morning so any help would be much appreciated...
address@hidden wrote:
>
> All,
> First the straight-forward heatbug questions:
> Why is findExtremeType needed?
> What is the enumerated types "hot" and "cold" used for?
> When actually running heatbugs, what is the "window" called
> HeatbugObserverSwarm (with DisplayFrequency: 1
> and a button called graphBug: on it) used for? You can change the
> values and hitting the button, just causes the computer to beep...
>
> Now I started "attempting" to change the code today, and wanted to add a
> way for happy bugs to reproduce, so at the end of step in heatbug.m I
> added"
> if (unhappiness < 0.05) {
> [Heatbug addHeatbug];
> }
> And then I tried may other attempts too numerated to list here. None of
> these worked...where should I have put that? I was thinking that maybe
> it needed to be put in heatbugModelSwarm in the buildActions method, but
> I'm not sure.
>
> And to ask a future question...I plan to create another window showing
> each bugs unhappiness level as a color maybe Blue sortof like the
> heatmap, but I plan to create it as a Discrete2d type instead of
> Diffused2d type like the heatspace...Do you think I need to create a new
> space "happyspace" modeled after "heatspace"? Or is there another
> better way to do this?
Since then I also attempted to make a function within HeatbugModelSwarm,
called reproduce. I added a Probe item called "haveSex" this is the
level of unhappiness where a heatbug would clone itself. Then I had a
flag interior to the heatbug, called happyFlag. It was set to 1 if they
were unhappiness < haveSex, otherwise its 0.
Then the reproduce method in HeatbugModel Swarm was basically the same
as the create Heatbug:
[world setOverwriteWarnings: 0];
if (unhappiness < haveSex) {
Heatbug * newbug;
int newIdealTemp, newOutputHeat;
//The new heatbug "inherits" state variables from its parent.
newIdealTemp = idealTemp;
newOutputHeat = outputHeat;
// Create the heatbug, Add it to the list, and initialize the state
varibles.
newBug = [Heatbug createBegin: [self getZone]];
[newBug setWorld: world Heat: heat];
newBug = [newBug createEnd];
[heatbugList addLast: newBug];
[newBug setPixmap: bugPixmap];
[newBug setIdealTemperature: newIdealTemp];
[newBug setOutputHeat: newOutputHeat];
[newBug setX: (x + 3) Y: y] //put the new bug near the parent.
Theres a chance
//that the baby will overwrite another
bug...I'll
//fix that later...[grin]
}
[world setOverwriteWarnings: 1]; // ok, done cheating.
return self;
}
I get all kinds of errors, including x,y not declared, createBegin
declared but never used, and many others.
I plan to then put this call in the modelActions stuff something like:
[modelActions createActionForEach: heatbugList reproduce]
will something like this work? How else can I do this?
Im I not approaching this right? Can anyone offer some suggestions of a
better way to do this?
==================================
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.
==================================