Hello all,
I just spent an hour or so chasing a strange glitch in my game, which makes a massive usage of Random, and the culprit is as follow:
1) This, as expected, yields a Set of 10 different numbers:
| b s |
b := [Random new]. s := Set new. 10 timesRepeat: [s add: b value next]. s
2) This yields a Set of one single number:
| b s |
b := [Random new]. s := Set new. 10 timesRepeat: [s add: b]. s collect: [:d | d value next]
Unless I am missing something, this looks like a pretty serious bug.
Tested in the latest trunk image, on win 64.
Stef
Hi Stéphane,
Please don't take this the wrong way, I'm just trying to nudge you in the right direction. Try looking at the size/contents of #s after "10 timesRepeat: [s add: b]".
Lou
On Mon, 4 Apr 2022 16:19:59 +0200, Stéphane Rollandin lecteur@zogotounga.net wrote:
Hello all,
I just spent an hour or so chasing a strange glitch in my game, which makes a massive usage of Random, and the culprit is as follow:
This, as expected, yields a Set of 10 different numbers:
| b s |
b := [Random new]. s := Set new. 10 timesRepeat: [s add: b value next]. s
This yields a Set of one single number:
| b s |
b := [Random new]. s := Set new. 10 timesRepeat: [s add: b]. s collect: [:d | d value next]
Unless I am missing something, this looks like a pretty serious bug.
Tested in the latest trunk image, on win 64.
Stef
Hi Stéphane, hi Louis --
... and we constantly have to remind our students about the difference between
(self player energy > 50) and: (self highscore > 5000)
and
(self player energy > 50) and: [self highscore > 5000]
And in this case, I think that #value is at the wrong place. :-)
Best, Marcel Am 04.04.2022 16:28:37 schrieb Louis LaBrunda lou@keystone-software.com: Hi Stéphane,
Please don't take this the wrong way, I'm just trying to nudge you in the right direction. Try looking at the size/contents of #s after "10 timesRepeat: [s add: b]".
Lou
On Mon, 4 Apr 2022 16:19:59 +0200, Stéphane Rollandin wrote:
Hello all,
I just spent an hour or so chasing a strange glitch in my game, which makes a massive usage of Random, and the culprit is as follow:
- This, as expected, yields a Set of 10 different numbers:
| b s |
b := [Random new]. s := Set new. 10 timesRepeat: [s add: b value next]. s
- This yields a Set of one single number:
| b s |
b := [Random new]. s := Set new. 10 timesRepeat: [s add: b]. s collect: [:d | d value next]
Unless I am missing something, this looks like a pretty serious bug.
Tested in the latest trunk image, on win 64.
Stef
-- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon
Ah, stupid me - right:)
So I did not find my bug... but there is one I swear! I'll show it to you when I get it!
Stef (humiliated:)
Hey Stéphane,
Don't feel bad, we all make stupid mistakes. The older one gets, the more one makes. I just posted one of mine on the VA Smalltalk forum.
Lou
On Mon, 4 Apr 2022 16:59:14 +0200, Stéphane Rollandin lecteur@zogotounga.net wrote:
Ah, stupid me - right:)
So I did not find my bug... but there is one I swear! I'll show it to you when I get it!
Stef (humiliated:)
Hey Stéphane,
Don't feel bad,
No, that's aokay, and thanks for your attention BTW. Now I just have to hunt my bug down again - it was while trying to reproduce it as a simpler model that I came up with this dumb snippet... I guess I just convinced myself I had found something, out of sheer desperation. sigh...
Best
Stef
squeak-dev@lists.squeakfoundation.org