Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tigers - Mica Chau #126

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Tigers - Mica Chau #126

wants to merge 8 commits into from

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.

i += 1;
}
}
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 false;
}
}
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.

if (word.length > 6) {
total_score += 8;
}
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