-
Notifications
You must be signed in to change notification settings - Fork 169
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
base: main
Are you sure you want to change the base?
Tigers - Mica Chau #126
Conversation
There was a problem hiding this 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 = { |
There was a problem hiding this comment.
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.
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; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i += 1; | ||
} | ||
} | ||
return hand; | ||
}; | ||
|
||
export const usesAvailableLetters = (input, lettersInHand) => { |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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.
No description provided.