Skip to content

Commit

Permalink
Add parentheses for readability and documentation improvements. See #75.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luisav1 committed Dec 11, 2021
1 parent cff9039 commit 66a720d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion js/game/model/NumberPlayGameLevel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ abstract class NumberPlayGameLevel {
this.oldChallengeNumberOne = this.challengeNumberProperty.value;

let newChallengeNumber = this.getRandomChallengeNumber();
while ( newChallengeNumber === this.oldChallengeNumberOne && newChallengeNumber === this.oldChallengeNumberTwo ) {
while ( ( newChallengeNumber === this.oldChallengeNumberOne ) && ( newChallengeNumber === this.oldChallengeNumberTwo ) ) {
newChallengeNumber = this.getRandomChallengeNumber();
}
this.challengeNumberProperty.value = newChallengeNumber;
Expand Down
2 changes: 1 addition & 1 deletion js/game/model/NumberPlayGameModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class NumberPlayGameModel {
this.subitizeLevels = gameBLevelNumbers.map( gameBLevelNumber => new SubitizeGameLevel( gameBLevelNumber ) );
this.levels = [ ...this.countingLevels, ...this.subitizeLevels ];

// the selected game level - null means 'no selection' and causes the view to return to the level-selection UI
// the selected game level - null means 'no selection' so that the view returns to the level-selection UI
this.levelProperty = new Property<SubitizeGameLevel | CountingGameLevel | null>( null, {
validValues: [ null, ...this.levels ]
} );
Expand Down
4 changes: 2 additions & 2 deletions js/game/model/Subitizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class Subitizer {
const challengeNumber = this.challengeNumberProperty.value;
let points;

if ( this.randomOrPredetermined && dotRandom.nextDouble() <= PROBABILITY_OF_PREDETERMINED_SHAPE ) {
if ( this.randomOrPredetermined && ( dotRandom.nextDouble() <= PROBABILITY_OF_PREDETERMINED_SHAPE ) ) {
points = Subitizer.getPredeterminedShapePoints( challengeNumber );
}
else if ( this.randomOrPredetermined ) {
Expand Down Expand Up @@ -339,7 +339,7 @@ class Subitizer {

// add a new point if it doesn't exist yet and does not overlap with the existing points
const objectsOverlap = Subitizer.objectsOverlap( points, randomX, randomY );
if ( !_.find( points, object => object.x === randomX && object.y === randomY ) && !objectsOverlap ) {
if ( !_.find( points, object => ( object.x === randomX ) && ( object.y === randomY ) ) && !objectsOverlap ) {
points.push( new Vector2( randomX, randomY ) );
}
}
Expand Down

0 comments on commit 66a720d

Please sign in to comment.