Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumberPlayGameModel creates levels conditionally, which will break PhET-iO API. #105

Closed
pixelzoom opened this issue Dec 17, 2021 · 3 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Dec 17, 2021

For #84. I originally mentioned in #92 (comment), but I thought this was worthy of its own issue, so I moved it here.

NumberPlayGameModel currently creates instances of CountingGameLevel and SubitizeGameLevel, based on the value of ?gameLevels. Since I see that NumberPlayGameModel has a tandem parameter, Games levels will presumably be PhET-iO instrumented in the future. And conditionally creating them will then be a big problem - omitting a level will break the PhET-iO API, and potentially the client's wrapper code.

To resolve this, NumberPlayGameModel must ALWAYS create all 4 levels. Then the view should expose only those levels that are specified by gameLevels, by hiding level-selection buttons that are no included in gameLevels. See equality-explore.LevelSelectionNode and fourier-making-waves.WaveGameLevelSelectionNode for examples.

This change is necessary regardless of how you choose to address the gameLevels query parameter in #92.

@Luisav1
Copy link
Contributor

Luisav1 commented Dec 17, 2021

@chrisklus and I worked on this together. We are creating all the levels and the buttons now but are only including the specified buttons in the selection. We might adjust how this is done depending on the results of the discussion from #92.

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Dec 21, 2021

Mentioned at 12/21 design meeting for #92...

To "PhET-iO proof" the sim, all of the buttons should be added to scenegraph, then set visible: false for the ones that are not in gameLevels. This will allow the PhET-iO client to get at them if needed.

Your layout for the level-selection buttons will be something like:

new VBox( {
  children: [
    new HBox( { children: [ ... ] }, ... ), // row of Counting buttons
    new HBox( { children: [ ... ] }, ...),  // row of Subitize buttons
  ],
  ...
} );

... then confirm with @amanda-phet that the layout looks good for various values of ?gameLevels.

@chrisklus
Copy link
Contributor

This work was completed, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants