[squeak-dev] What is happening here?

Marcel Taeumel marcel.taeumel at hpi.de
Mon Apr 4 14:34:39 UTC 2022


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 at 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:
>
>
>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
>
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220404/3798349b/attachment.html>


More information about the Squeak-dev mailing list