Skip to content

Commit

Permalink
doc FACE_COLORS, generate FaceNode using FACE_COLORS.map, #80
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Feb 24, 2023
1 parent 9e870f1 commit d56234a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions js/game/view/RPALRewardNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import SandwichNode from '../../sandwiches/view/SandwichNode.js';

// constants
const NUMBER_OF_NODES = 100;
const FACE_COLORS = [ 'yellow', 'rgb(255,85,0)', 'orange', 'magenta', 'cyan', 'rgb(100,255,100)' ];

// constructors for all atoms & molecules that appear in reactions, to appear in Level 1 reward
const MOLECULE_NODE_CONSTRUCTORS = [
Expand All @@ -69,6 +68,9 @@ const MOLECULE_NODE_CONSTRUCTORS = [
SNode, SO2Node, SO3Node
];

// Smiley face colors, to appear in Level 2 reward
const FACE_COLORS = [ 'yellow', 'rgb(255,85,0)', 'orange', 'magenta', 'cyan', 'rgb(100,255,100)' ];

export default class RPALRewardNode extends RewardNode {

/**
Expand All @@ -89,10 +91,7 @@ function createNodesLevel1() {

// Level 2: smiley faces (various colors), @returns {Node[]}
function createNodesLevel2() {
const nodes = [];
FACE_COLORS.forEach( color => {
nodes.push( new FaceNode( 40, { headFill: color } ) );
} );
const nodes = FACE_COLORS.map( color => new FaceNode( 40, { headFill: color } ) );
return RewardNode.createRandomNodes( nodes, NUMBER_OF_NODES );
}

Expand Down

0 comments on commit d56234a

Please sign in to comment.