swarm-support
[Top][All Lists]
Advanced

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

Re: Heatbug.java question


From: David Smith
Subject: Re: Heatbug.java question
Date: Thu, 13 Jan 2000 15:12:19 -0700 (MST)

I see now that deep in the bowels of findExtremeType$X$Y() the x & y
coordinates of the object passed to the function get changed to those of
the optimum neighbor (or a random choice of equal optimums). And after 
the function returns, those x & y coordinates are accessed as the ivars of 
the object that was passed.

The confusing thing is that findExtremeType$X$Y() is used for something
very different from its apparent purpose. Its return type is long. It 
returns the heat value of the optimum neighbor, but that value falls into 
the bit bucket because it is never used. I don't see where the function 
is used anywere else in jheatbugs either.

David Smith

On 13 Jan 2000, Marcus G. Daniels wrote:

> >>>>> "DS" == David Smith <address@hidden> writes:
> 
> DS> First, the block enclosed by the {} doesn't belong to any function
> DS> or operation.
> 
> The {} aren't required.  It's just a way to delimit code and variables
> in a visible way.  In C, {} are required in order to introduce new
> local variables.
> 
> DS> Second, the HeatSpace method findExtremeType$X$Y() is supposed to
> DS> return a long value, but nothing is assigned that value within the
> DS> block.
> 
> A heatcell is passed in, and its ivars are assigned findExtremeType$X$Y, and
> ten copied out after the call.  (Java doesn't have pointers or multiple
> return values.)
> 
> DS> Third, What do HeatSpace.hot and HeatSpace.cold do without at
> DS> least an empty set of parameter ()'s following. 
> 
> See http://java.sun.com/docs/books/jls/html/15.doc.html#41267.
> 
> DS> But even if it does that, the whole ghostly function doesn't
> DS> do anything anyway.
> 
> So you're saying that if you add:
> 
>       if (newX != heatCell.x || newY != heatCell.y)
>         System.out.println (newX + " -> " + heatCell.x + " " + newY + " ->" + 
> heatCell.y);
> 
> after the call to findExtremeType$X$Y, there is no output?
> 
> 
>                   ==================================
>    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.
> 
> 

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