Skip to content

Commit

Permalink
Pull from the end of the inactiveCountingObjects array, #35
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Dec 6, 2024
1 parent 21b6e9c commit f66765b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/common/model/DecompositionModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export default class DecompositionModel extends NumberPairsModel {
sceneModel.leftAddendObjects.push( sceneModel.inactiveCountingObjects[ 0 ] );
} );
_.times( sceneModel.rightAddendProperty.value, () => {
sceneModel.rightAddendObjects.push( sceneModel.inactiveCountingObjects[ 0 ] );

// We want to pull from the end of the inactiveCountingObjects array to keep as much consistency as possible
// between which countingObjects belong to which addend in the initial state.
sceneModel.rightAddendObjects.push( sceneModel.inactiveCountingObjects[ sceneModel.inactiveCountingObjects.length - 1 ] );
} );

assert && assert( sceneModel.leftAddendObjects.length + sceneModel.rightAddendObjects.length === sceneModel.total, 'leftAddendObjects.length + rightAddendObjects.length should equal total' );
Expand Down

0 comments on commit f66765b

Please sign in to comment.