swarm-support
[Top][All Lists]
Advanced

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

Re: tipsybug: bugreport?


From: mcmullin
Subject: Re: tipsybug: bugreport?
Date: Thu, 20 Mar 1997 09:10:35 -0700 (MST)

On 20 Mar, Ludo Pagie wrote:
> Hello Barry and all others,
> in the function
> 
> -(NeighborCode) getRandomNeighborCodeExcluding: (NeighborCode) inNeighborCode 
> {
> 
> 
> both in MooreNeighborhood.h/m and VNneighborhood.h/m the following piece of
> code seems (to me at least) faulty:
> 
> 
> 
> 
> 
>   randomNeighborCode = [self getNextNeighborCode: inNeighborCode];
> 
>   if (uniformUnsigned == nil)
>     [InternalError raiseEvent:
>       "Attempt to -getRandomNeighborCodeExcluding,\n"
>        "but uniformUnsigned is nil.\n"];
>   else {
>     randomNumber = [uniformUnsigned getUnsignedWithMin: 0 withMax: 2];
>     while (randomNumber > 0) {
>       randomNeighborCode = [self getNextNeighborCode: inNeighborCode];
>       randomNumber--;
>     }
>   }
> 
>   return (randomNeighborCode);
> 
> 
> The problem is in the (re-)assignment of 'randomNeighborCode' to
> [self getNextNeighborCode:  inNeighborCode];
> 
> I'd say that no matter the value of 'randomNumber' the return value will 
> always
> be the neighbour of 'inNeighborCode'.
> 
> I think that a fix could be:
> randomNeighborCode = [self getNextNeighborCode: randomNeighborCode];
> 
> 
> 
> Ludo.

Yup - ya got me!

I reckon your fix is correct.  (I'm not sure whether
that method is actually invoked at all in Tipsybugs
itself, but I'd better scuttle off and check anywhere
else it might be used - thanks!)

- Barry.


-- 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| Barry McMullin, ALife Group,               |    address@hidden |
| Santa Fe Institute, 1399 Hyde Park Road,   |  Voice: +1-505-984-8800 |
| Santa Fe, NM 87501, USA.                   |  FAX:   +1-505-982-0565 |
| http://www.eeng.dcu.ie/~mcmullin           |                         |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




reply via email to

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