Skip to content

Conversation

@gwhitney
Copy link
Collaborator

By submitting this PR, I am indicating to the Numberscope maintainers that I have read and understood the contributing guidelines and that this PR follows those guidelines to the best of my knowledge. I have also read the pull request checklist and followed the instructions therein.


Previously, references were being held to the HTML containers for visualizers. This would hinder garbage collection and allow visualizers to reawaken and continue to draw in a "zombie" state in which they were not connected to any visible element, draining cpu resources.

The PR removes all such references, preventing frontscope from bogging down as you switch back and forth from the gallery to individual visualizers.

It also fixes a typo in the definition of VFib Snowflake, and patches a bug which allowed some FormulaGrid visualizations to draw forever, rather than stopping once they had displayed everything available.

Resolves #581.

@katestange
Copy link
Member

First, I noticed a bug in the Integersteller gallery item which I'm hoping can be rolled into this too. It's not strictly speaking a bug, but it's not the desired thing, either. If you go to Integersteller and then try to change sequence, the picture doesn't actually change for any other sequence. That's because the formula has gcd(x,y) in it instead of gcd(A(x),A(y)). They are the same on the integers, but the latter would adapt the visualization to any other sequence, which is a natural thing the user would like to do when they click "change sequence". Ooops! Can we roll it in here?

@katestange
Copy link
Member

Next up, here's a real bug. To reproduce:

  1. Go to gallery, click on one of the turtle visualizations, say Raucus Recaman.
  2. Click on change sequence and make sure you are set to thumbnails. You see thumbnails for the default turtle settings, not for the current visualizer settings, as you should.

So apparently we removed too much of something. This appears to be specific to Turtle.

As an apparently separate issue, Recaman seems to fail and give a sad face (not a proper error) on the canvas in the background if you leave the change sequence thumbnail modal up for a bit and/or switch windows a bit. But this seems to happen in ui2 also.

@gwhitney
Copy link
Collaborator Author

That's because the formula has gcd(x,y) in it instead of gcd(A(x),A(y)). They are the same on the integers, but the latter would adapt the visualization to any other sequence, which is a natural thing the user would like to do when they click "change sequence". Ooops! Can we roll it in here?

Not great practice but under the pressure of trying to have this ready for this upcoming week, OK, let's do it. But to be clear, the formula should become:

{circle:
  yellow.mix(black, 1-gcd(A(x),A(y))/sqrt(A(x)A(y))),
mouseover: [
    'gcd(', A(x), ', ', A(y), ') = ', gcd(A(x),A(y))
]}

Correct? Or do we want:

{circle:
  yellow.mix(black, 1-gcd(A(x),A(y))/sqrt(A(x)A(y))),
mouseover: [
    '@', x, ', ', y, ': gcd(', A(x), ', ', A(y), ') = ', gcd(A(x),A(y))
]}

so that you also see where your cursor is in addition to the sequence values? It will be redundant for Integerstellar, but could be helpful for other sequences...
Let me know if I've got these right and which you prefer and I will put it in.

@gwhitney
Copy link
Collaborator Author

Next up, here's a real bug. To reproduce:

1. Go to gallery, click on one of the turtle visualizations, say Raucus Recaman.

2. Click on change sequence and make sure you are set to thumbnails.  You see thumbnails for the _default_ turtle settings, not for the current visualizer settings, as you should.

So apparently we removed too much of something. This appears to be specific to Turtle.

Should be fixed with the latest commit. Thanks for the great catch.

@gwhitney
Copy link
Collaborator Author

As an apparently separate issue, Recaman seems to fail and give a sad face (not a proper error) on the canvas in the background if you leave the change sequence thumbnail modal up for a bit and/or switch windows a bit. But this seems to happen in ui2 also.

Unable to reproduce. Please either post a very explicit recipe for causing the behavior, or we can wait 'til post-alpha. I was hoping to deploy alpha before I got on the plane, but I guess that won't be happening :-/ so I guess another alternative is you can show me :-).

What I will do now is check in the second Intergerstellar patch above, that pops up both the location and the gcd, guessing that's the one we want, to try to minimize the steps until we can deploy. But if you'd rather have something different, just let me know and of course we can change it again.

If you do happen to look at this again before you sleep, feel free to send feedback, if I can act before I get on the plane I will. Thanks!

@gwhitney
Copy link
Collaborator Author

OK, the adjustment to the Integerstellar formula is in, the second version I posted that shows the location and the gcd. So as far as I am concerned, this is ready to merge and then ui2 is ready to go to main and alpha is ready to be deployed. So the only remaining questions:

  • Is there still a concern about Recaman erroring in the background that we want to track down before alpha? If so, I need to know how to reproduce that since I haven't observed it.
  • Do we want any further tweaks to the new Integerstellar formula?
  • Is there any further checking/review anyone wants to do before this is deployed?

I am standing by, will take action on any feedback as soon as I can. Sorry this came down to the wire.

@katestange
Copy link
Member

Correct? Or do we want:

Yes, correct, the first of your two formulas seems the most correct and informative to me.

@katestange
Copy link
Member

Correct? Or do we want:

Yes, correct, the first of your two formulas seems the most correct and informative to me.

Oh wait, I misunderstood! The second formula seems reasonable. I'll try it.

@katestange
Copy link
Member

* Is there still a concern about Recaman erroring in the background that we want to track down before alpha? If so, I need to know how to reproduce that since I haven't observed it.

Can't reproduce either -- maybe my browser was in a weird state?

* Do we want any further tweaks to the new Integerstellar formula?

No, looks good now.

* Is there any further checking/review anyone wants to do before this is deployed?

It all looks good to me!!

@katestange katestange merged commit 42d28bb into numberscope:ui2 Jan 11, 2026
2 checks passed
gwhitney added a commit that referenced this pull request Jan 12, 2026
…alizer (#585)

* fix: ensure that visualizations are cleaned up when they are supposed to

* fix: Don't add a viewscale parameter if the thumbscale not specified

* refactor: Redefine Integerstellar to better employ the selected sequence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants