You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In phetsims/vegas#73 and phetsims/vegas#75, the consensus was to make vegas use 1-based level numbering. And that 1-based level numbering in the model may be advantageous for PhET-iO, but should be evaluated on a sim-by-sim basis.
Making the requested change for FiniteStatusBar proved to be complicated. It has option levelProperty, which is typically a model Property. And several sims (including this one) use 0-based level numbering in the model, so that the level number can be used as an index into arrays. I investigated changing the semantics of the model Property to be 1-based, but that turned into a large task, touching dozens of files, potentially error prone.
To avoid changing the model semantics, I added a DerivedProperty that handles the mapping from 0-based to 1-based level numbering. In general, it looks like this:
varstatusBar=newFiniteStatusBar( ...,{
...
// FiniteStatusBar uses 1-based level numbering, model is 0-based.levelProperty: newDerivedProperty([model.levelProperty],function(level){returnlevel+1;})});
At some point, evaluate whether this sim's model should be converted to 1-based level numbering. If so, after converting, the above DerivedProperty can be removed, i.e.:
There's no reason to do this, not even for PhET-iO. If 1-based numbering is needed for PhET-iO, then instrument the DerivedProperty that's passed to FiniteStatusBar, it is 1-based. See GamePlayNode line 61:
In phetsims/vegas#73 and phetsims/vegas#75, the consensus was to make vegas use 1-based level numbering. And that 1-based level numbering in the model may be advantageous for PhET-iO, but should be evaluated on a sim-by-sim basis.
Making the requested change for FiniteStatusBar proved to be complicated. It has option
levelProperty
, which is typically a model Property. And several sims (including this one) use 0-based level numbering in the model, so that the level number can be used as an index into arrays. I investigated changing the semantics of the model Property to be 1-based, but that turned into a large task, touching dozens of files, potentially error prone.To avoid changing the model semantics, I added a DerivedProperty that handles the mapping from 0-based to 1-based level numbering. In general, it looks like this:
At some point, evaluate whether this sim's model should be converted to 1-based level numbering. If so, after converting, the above DerivedProperty can be removed, i.e.:
The text was updated successfully, but these errors were encountered: