Rectangle bug? Things not repeating forever?


Ok so the first bug is:
What is with this orange rectangle?
That's not supposed to be there!
It only appears when I tap the publish button so it only appears in the thumbnail not the actual project.

But here's what it should look like in the thumbnail

Ok this must be because of the clones that I made but I didn't make anything so it would show up every time I try to publish or remix this project.

Now for the second bug
I know how to recreate this one
So this one is you put something in a repeat forever block and put a repeat random 0 to 10 block in it and it doesn't repeat forever. This is avoidable though just make it repeat 1 to 10 instead of 0 to 10.
Here's a picture of the code
This is the code to make the bug

And using this code this is as far as it got:

But this is the code to make it work

And it works just fine

It probably has something to do with when it repeats 0 times but it should go on normally
Thanks for reading!


Maybe it had it's size set to 0.


Few things:

  1. Repeat 0 times is like a automatic stop. That's why.

  2. Are you familiar with my 3D SpaceShip simulator? Do you see the three rectangles on the towering hexagons? They should not be there:


Here, the three rectangles appear.

Pretty weird bug...

Thumbnail different than project bug

Oh but hmm I think it is just meant to repeat the blocks inside it 0 times, not stop the whole code :thinking::smiley:

And I have never seen that screenshot rectangle bug before :hushed:


Wow, that is amazing, I never knew this. This would be helpful in many projects. Thanks for sharing


@MR.GAM3R @BlastFusion I think that if you put a Repeat Forever and a Wait 9999 or whatever milliseconds then it is also a stop.

But if you have

Repeat Forever
    Repeat times myVar
        // Code

And if you change the value of myVar to different numbers including 0, negative numbers, it won't execute the code inside the second Repeat.

But if you then set myVar to positive numbers elsewhere in your code, on the next run of the Repeat Forever loop, it should use the new value of myVar again, and run the code inside.

Funky63 used to use this for something he called states but I am not sure if it works in Hopscotch now โ€“ I was going to grab a link, but I found something more related and seems to work still:

we might expect Repeat random(0-10) to work similarly as this but it looks like it isn't :thinking:



Repeat 0 isn't a "stop". It just skips the code in the Repeat 0 block. I use that often to create some "dead code" that I don't what to execute, but I'm not quite sure that I want to delete yet.


@Liza @Rodrigo @awesomeonion

I took a closer look at the OP's bug with the Repeat & Random blocks. The bug is repeatable however I can give you more details to clarify it.

The issue is that this:

will result in a Repeat Forever loop some percentage of the time.

Repeat (0) is not the problem. Entering a zero directly results in skipping the code in the Repeat loop as expected.

Repeat (Random(0 to 0)) & Repeat (Random(0 to 1)) both also work as expected. However using a value >= 2 for the max value sometimes results in a Repeat Forever. But here's the kicker, it's not any specific one of the random results that causes the Repeat loop anomaly. To test if one of the specific results was causing the issue, I created a project to run a Monte Carlo simulation with 4000 samples (clones) which should be stastically significant enough.

  • Repeat (Random(0 to 2)) took about 9 loops on average to lock up (i.e. to turn into a Repeat Forever). if one of the results was causing the issue, it would take 2 loops on average
  • Repeat (Random(0 to 3)) drops to about 8 loops on average to lock up. if one of the results was causing the issue, it would take 2.5 loops on average
  • Repeat (Random(0 to 9)) go back up to about 12.5 loops. if one of the results was causing the issue, it would take 5.5 loops on average

Very odd.

For what it's worth, here's what I did for the Monte Carlo. The 'Random loop count' should never get higher than 'Max Random'. After all the clones are "frozen", it divides 'Loop avg' by 4000 to get the actual average.

Help us squash some bugs

Hmm okay. Makes sense.