-
Notifications
You must be signed in to change notification settings - Fork 20
Ocelots - McKay Warren #12
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
base: main
Are you sure you want to change the base?
Conversation
…re present on Adagrams prototype
| export const scoreWord = (word) => { | ||
| // Implement this method for wave 3 | ||
| }; | ||
| while (i < 10) { |
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.
This loops makes sense, and I don't think you really have to worry about it here, but when I see while loops like this, I think about adding some other kind of guard condition- like limiting the number of attempts, for example-- to catch a possible infinite loop if there weren't enough letters to be picked.
| let usesOnlyAvailableLetters = true; | ||
| [...input].forEach((letter) => { | ||
| const index = lettersInHand.indexOf(letter); | ||
| // indexOf method return -1 if letter not found |
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 appreciate the comment
| // indexOf method return -1 if letter not found | ||
| if (index != -1) { | ||
| // for splice, need to specify only 1 letter should be removed | ||
| lettersInHand.splice(index, 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.
concise-- nice usage of splice
| }; | ||
| let score = 0; | ||
|
|
||
| [...word].forEach((letter) => { |
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.
nice use of spread syntax
| const bestPlays = this.config.players | ||
| .map((player) => ({ player, ...this._bestPlay(round, player) })) | ||
| .filter(({ player, word, score }) => word !== undefined); | ||
| .map((player) => ({ player, ...this._bestPlay(round, player) })) |
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.
Ooh, nice use of map for looping through the players
| export const drawLetters = () => { | ||
| // Implement this method for wave 1 | ||
| }; | ||
| export default class Adagrams { |
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.
OOP!
No description provided.