-
Notifications
You must be signed in to change notification settings - Fork 50
Leaves - Yitgop #28
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: master
Are you sure you want to change the base?
Leaves - Yitgop #28
Conversation
JS AdagramsWhat We're Looking For
|
@@ -1,8 +1,125 @@ | |||
// 1. Set up array data structure: | |||
const pool = Array(9).fill('A').concat( |
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 data structure works, but it's not very DRY and would be tricky to change. For example, suppose I said you had the wrong number of "I"s - you would have to do a lot of counting to solve the problem.
Instead you might store a hash of letter frequencies like this
letterQuantities: {
A: 9, B: 2, ...
}
and use it to build a pool of letters dynamically.
// Implement this method for wave 1 | ||
let i = 0; | ||
const lettersInHand = new Array(10); | ||
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.
There's a small bug here. Consider how you could make sure that you don't choose the same letter 10 times (however unlikely)
} | ||
|
||
switch (final_word.length) { | ||
case 7: |
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.
Consider how you could refactor to DRY up this code.
Be/c17 update
JS Adagrams
Congratulations! You're submitting your assignment!
Comprehension Questions