Skip to content

Commit

Permalink
Removing the hollywooded values, see #39
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinVallejo committed Oct 3, 2024
1 parent 5f5647c commit 7c84cdb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 37 deletions.
16 changes: 3 additions & 13 deletions js/coins/view/MultiCoinTestBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

import Property from '../../../../axon/js/Property.js';
import TEmitter from '../../../../axon/js/TEmitter.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import Dimension2 from '../../../../dot/js/Dimension2.js';
import Vector2 from '../../../../dot/js/Vector2.js';
Expand All @@ -18,12 +19,10 @@ import WithRequired from '../../../../phet-core/js/types/WithRequired.js';
import { Color, HBox, HBoxOptions, LinearGradient, Node, Rectangle } from '../../../../scenery/js/imports.js';
import isSettingPhetioStateProperty from '../../../../tandem/js/isSettingPhetioStateProperty.js';
import TwoStateSystemSet from '../../common/model/TwoStateSystemSet.js';
import QuantumMeasurementConstants from '../../common/QuantumMeasurementConstants.js';
import quantumMeasurement from '../../quantumMeasurement.js';
import { MAX_COINS, MULTI_COIN_EXPERIMENT_QUANTITIES } from '../model/CoinsExperimentSceneModel.js';
import { MULTI_COIN_EXPERIMENT_QUANTITIES } from '../model/CoinsExperimentSceneModel.js';
import { ExperimentMeasurementState } from '../model/ExperimentMeasurementState.js';
import SmallCoinNode, { SmallCoinDisplayMode } from './SmallCoinNode.js';
import TEmitter from '../../../../axon/js/TEmitter.js';

type SelfOptions = EmptySelfOptions;
export type MultiCoinTestBoxOptions = SelfOptions & WithRequired<HBoxOptions, 'tandem'>;
Expand Down Expand Up @@ -178,15 +177,6 @@ export default class MultiCoinTestBox extends HBox {
else if ( this.numberOfActiveSystemsProperty.value === 100 ) {
setOffsets( BOX_SIZE, 10, 10 );
}
else if ( this.numberOfActiveSystemsProperty.value === MAX_COINS ) {
// N rows of N = sqrt( Hollywooded number of coins )
const sideLength = Math.sqrt( QuantumMeasurementConstants.HOLLYWOODED_MAX_COINS );
const BoxDimension = new Dimension2(
BOX_SIZE.width * QuantumMeasurementConstants.COIN_SET_AREA_PROPORTION + 3 * QuantumMeasurementConstants.HOLLYWOODED_MAX_COINS_RADII,
BOX_SIZE.height * QuantumMeasurementConstants.COIN_SET_AREA_PROPORTION + 3 * QuantumMeasurementConstants.HOLLYWOODED_MAX_COINS_RADII
);
setOffsets( BoxDimension, sideLength, sideLength );
}
return offset;
}

Expand All @@ -204,7 +194,7 @@ export default class MultiCoinTestBox extends HBox {
radius = 6;
}
else {
radius = QuantumMeasurementConstants.HOLLYWOODED_MAX_COINS_RADII;
radius = 2;
}
return radius;
}
Expand Down
8 changes: 3 additions & 5 deletions js/coins/view/MultipleCoinAnimations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
*/

import TProperty from '../../../../axon/js/TProperty.js';
import isSettingPhetioStateProperty from '../../../../tandem/js/isSettingPhetioStateProperty.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import Animation from '../../../../twixt/js/Animation.js';
import Easing from '../../../../twixt/js/Easing.js';
import { MEASUREMENT_PREPARATION_TIME } from '../../common/model/TwoStateSystemSet.js';
import QuantumMeasurementConstants from '../../common/QuantumMeasurementConstants.js';
import quantumMeasurement from '../../quantumMeasurement.js';
import CoinsExperimentSceneModel, { MULTI_COIN_EXPERIMENT_QUANTITIES } from '../model/CoinsExperimentSceneModel.js';
import CoinExperimentMeasurementArea from './CoinExperimentMeasurementArea.js';
import CoinsExperimentSceneView from './CoinsExperimentSceneView.js';
import MultiCoinTestBox from './MultiCoinTestBox.js';
import SmallCoinNode from './SmallCoinNode.js';
import isSettingPhetioStateProperty from '../../../../tandem/js/isSettingPhetioStateProperty.js';

const COIN_TRAVEL_ANIMATION_DURATION = MEASUREMENT_PREPARATION_TIME * 0.95;

Expand All @@ -43,11 +42,10 @@ public readonly startIngressAnimationForCoinSet: ( forReprepare: boolean ) => vo
// The 10000 coins case will be animated separately
const ANIMATION_QUANTITIES = MULTI_COIN_EXPERIMENT_QUANTITIES.filter( quantity => quantity !== 10000 );
ANIMATION_QUANTITIES.forEach( quantity => {
const quantityToCreate = Math.min( quantity, QuantumMeasurementConstants.HOLLYWOODED_MAX_COINS );
const radius = MultiCoinTestBox.getRadiusFromCoinQuantity( quantity );
const coinNodes: SmallCoinNode[] = [];
_.times( quantityToCreate, () => {
coinNodes.push( new SmallCoinNode( radius, { visible: quantity !== 10000, tandem: Tandem.OPT_OUT } ) ); // TODO: Find a better way to not display these coins https://github.com/phetsims/quantum-measurement/issues/39
_.times( quantity, () => {
coinNodes.push( new SmallCoinNode( radius, { tandem: Tandem.OPT_OUT } ) );
} );
movingCoinNodes.set( quantity, coinNodes );
} );
Expand Down
21 changes: 2 additions & 19 deletions js/common/QuantumMeasurementConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import quantumMeasurement from '../quantumMeasurement.js';

const QuantumMeasurementConstants = {
LAYOUT_BOUNDS: ScreenView.DEFAULT_LAYOUT_BOUNDS,
COIN_SET_AREA_PROPORTION: 0.9, // Side of the explicit coin area with respect to the measurement area
SCREEN_VIEW_X_MARGIN: 15,
SCREEN_VIEW_Y_MARGIN: 15,
ALPHA: '\u03b1',
Expand All @@ -19,25 +20,7 @@ const QuantumMeasurementConstants = {
SPIN_DOWN_ARROW_CHARACTER: '\u2b63',
CLASSICAL_UP_SYMBOL: '\uD83C\uDF1E\uFE0E\uFE0E', // 🌞 Sun symbol
CLASSICAL_DOWN_SYMBOL: '\u263D', // 🌙 Moon Symbol
KET: '\u27e9',
COIN_SET_AREA_PROPORTION: 0.9, // Side of the explicit coin area with respect to the measurement area

HOLLYWOODED_MAX_COINS_RADII: 2,
HOLLYWOODED_MAX_COINS: 121 // This number should be used when *showing* fewer coins than the max allowed.
/**
* TODO: Temporary list of square numbers for the hollywooded number of coins above. https://github.com/phetsims/quantum-measurement/issues/39
* N N*N
* 20 400
* 25 625
* 30 900
* 35 1225
* 40 1600
* 50 2500
* 60 3600
* 70 4900
* 90 8100
* 100 10000
*/
KET: '\u27e9'
};

quantumMeasurement.register( 'QuantumMeasurementConstants', QuantumMeasurementConstants );
Expand Down

0 comments on commit 7c84cdb

Please sign in to comment.