Polygonception - run out of memory/time

I’m finding this level (polygonception) quite frustrating… if a yak has 5 or 6 sides I usually run out of memory or time before completing the level.
I finally got a run with only squares and triangles:

and it doesn’t seem to like my squares. Can anyone see what’s wrong with them?
I could post my code but don’t want to spoil it for others…

Thanks in advance for the help!

Can you try refreshing the browser before each run? If I recall correctly, there were some memory leak issues regarding flower levels.

1 Like

Based on your picture it seems like you are calling your function too many times (you are drawing one extra set of polygons per corner.) Do you have a base case that looks like

if distance <= 2: return
1 Like

I used

if distance > 2: don't return

which should function the same way I think?

Edit: Ah, thanks @trotod - I changed it to if distance > 10: and it worked. I didn’t code it quite the same as the example and I think I was evaluating the magnitude of the vector before I’d worked out a fifth of it. Your spot helped me see it!
Also refreshing did help with memory issues, thanks @UltCombo

Happy Days! :smile:

1 Like