[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tipsybug: bugreport?
From: |
Ludo Pagie |
Subject: |
tipsybug: bugreport? |
Date: |
Thu, 20 Mar 1997 15:36:07 +0100 |
Hello Barry and all others,
couldn't find anything in the mail archive (within timelimits) about a bug (?)
in tipsybug V0.05, so FWIW:
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.
- tipsybug: bugreport?,
Ludo Pagie <=