Skip to content

Commit

Permalink
Add the model Property and parametrize both screens, see #2
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Oct 11, 2019
1 parent 15128ff commit 6c3eeed
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
4 changes: 4 additions & 0 deletions js/common/NumberPlayConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ define( require => {

const NumberPlayConstants = {

// the two defining numbers of this sim
TEN: 10,
TWENTY: 20,

// layout
SCREEN_VIEW_X_MARGIN: 15,
SCREEN_VIEW_Y_MARGIN: 15,
Expand Down
13 changes: 10 additions & 3 deletions js/common/model/NumberPlayModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,29 @@ define( require => {

// modules
const numberPlay = require( 'NUMBER_PLAY/numberPlay' );
const NumberProperty = require( 'AXON/NumberProperty' );
const Range = require( 'DOT/Range' );

class NumberPlayModel {

/**
* @param {number} highestCount - the highest integer number that can be counted to
* @param {Tandem} tandem
*/
constructor( tandem ) {
//TODO
constructor( highestCount, tandem ) {

// @public {NumberProperty} - the current "counted to" number, which is the central aspect of this whole sim
this.currentNumberProperty = new NumberProperty( 0, {
range: new Range( 0, highestCount )
} );
}

/**
* Resets the model.
* @public
*/
reset() {
//TODO
this.currentNumberProperty.reset();
}
}

Expand Down
6 changes: 2 additions & 4 deletions js/ten/model/TenModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ define( require => {

// modules
const numberPlay = require( 'NUMBER_PLAY/numberPlay' );
const NumberPlayConstants = require( 'NUMBER_PLAY/common/NumberPlayConstants' );
const NumberPlayModel = require( 'NUMBER_PLAY/common/model/NumberPlayModel' );

/**
* @constructor
*/
class TenModel extends NumberPlayModel {

/**
* @param {Tandem} tandem
*/
constructor( tandem ) {
super( tandem );
super( NumberPlayConstants.TEN, tandem );
}
}

Expand Down
6 changes: 2 additions & 4 deletions js/twenty/model/TwentyModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ define( require => {

// modules
const numberPlay = require( 'NUMBER_PLAY/numberPlay' );
const NumberPlayConstants = require( 'NUMBER_PLAY/common/NumberPlayConstants' );
const NumberPlayModel = require( 'NUMBER_PLAY/common/model/NumberPlayModel' );

/**
* @constructor
*/
class TwentyModel extends NumberPlayModel {

/**
* @param {Tandem} tandem
*/
constructor( tandem ) {
super( tandem );
super( NumberPlayConstants.TWENTY, tandem );
}
}

Expand Down

0 comments on commit 6c3eeed

Please sign in to comment.