-
Notifications
You must be signed in to change notification settings - Fork 169
ivy s - lions #128
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?
ivy s - lions #128
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.
Excellent job! There are some comments below on places to make the code cleaner/simpler. For commits, it would be great if the commit messages could be more descriptive. Instead of talking about which wave was completed, something like "Created drawLetters function" would be great. Great job!
// Implement this method for wave 1 | ||
}; | ||
|
||
const letterPool = { |
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 can be declared outside of the function so that it doesn't have to be recreated each time the function is called.
let letterList = []; | ||
|
||
for (let letter in letterPool){ | ||
let freq = letterPool[letter]; | ||
for (let i = 0 ; i < freq ; i++) { | ||
letterList.push(letter); | ||
} | ||
} | ||
|
||
let hand = []; | ||
while (hand.length < 10){ | ||
let index = Math.floor(Math.random()*letterList.length); | ||
let letterDrawn = letterList[index]; | ||
hand.push(letterDrawn); | ||
letterList.splice(index, 1); | ||
} | ||
return hand; |
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.
Excellent!
|
||
} | ||
|
||
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.
Excellent!
export const scoreWord = (word) => { | ||
// Implement this method for wave 3 | ||
}; | ||
const pointValues = { |
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 can be declared outside of the function.
let total = 0; | ||
let wordUpper = word.toUpperCase(); | ||
|
||
if (6 < word.length && word.length < 11) { | ||
total += 8 | ||
} | ||
for (let letter of wordUpper){ | ||
let letPoint = pointValues[letter]; | ||
total += letPoint; | ||
} | ||
|
||
return total; |
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.
Excellent!
return total; | ||
} | ||
|
||
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.
Excellent!
expectScores({ | ||
|
||
}) |
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.
Looks like this test was not completed. Make sure to complete all tests!
const correct = { word: "XXXX", score: scoreWord("XXXX") }; | ||
|
||
throw "Complete test by adding an assertion"; | ||
expect(highestScoreFrom(words)).toEqual(correct); |
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.
Excellent!
No description provided.