Skip to content

Conversation

@mc-dev99
Copy link

@mc-dev99 mc-dev99 commented Dec 8, 2022

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done Mica, you hit the learning goals here. Well done.

Z: 1,
};

const LETTERPOINTS = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this way of scoring letters and the above object for generating the pool.

Comment on lines +63 to +70
while (i < 10) {
let letterIndex = Math.floor(Math.random() * 26);
if (letterPool[letterIndex][1] > 0) {
hand.push(letterPool[letterIndex][0]);
letterPool[letterIndex][1] -= 1;
i += 1;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ One problem here. This solution means you have an equal possibility of drawing a 'Z' and an 'A' despite there being more 'A's than 'Z's in the pool.

return hand;
};

export const usesAvailableLetters = (input, lettersInHand) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I like the helper function and it's an interesting way to do this.

return true;
};

export const scoreWord = (word) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the use of map and reduce.

return total_score;
};

export const highestScoreFrom = (words) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I like the helper function and good use of JS functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants