Skip to content

Tigers - Mica Chau#126

Open
mc-dev99 wants to merge 8 commits intoAda-C18:mainfrom
mc-dev99:main
Open

Tigers - Mica Chau#126
mc-dev99 wants to merge 8 commits intoAda-C18:mainfrom
mc-dev99:main

Conversation

@mc-dev99
Copy link
Copy Markdown

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

No description provided.

Copy link
Copy Markdown

@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.

Comment thread src/adagrams.js
Z: 1,
};

const LETTERPOINTS = {
Copy link
Copy Markdown

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 thread src/adagrams.js
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;
}
}
Copy link
Copy Markdown

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.

Comment thread src/adagrams.js
return hand;
};

export const usesAvailableLetters = (input, lettersInHand) => {
Copy link
Copy Markdown

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.

Comment thread src/adagrams.js
return true;
};

export const scoreWord = (word) => {
Copy link
Copy Markdown

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.

Comment thread src/adagrams.js
return total_score;
};

export const highestScoreFrom = (words) => {
Copy link
Copy Markdown

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