-
Notifications
You must be signed in to change notification settings - Fork 33
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
Leaves - Yitgop & Bri #19
base: master
Are you sure you want to change the base?
Conversation
AdagramsWhat We're Looking For
|
@@ -143,7 +147,8 @@ | |||
# verify both have a score of 10 | |||
expect(score_word(words.first)).must_equal 18 | |||
expect(score_word(words.last)).must_equal 18 | |||
|
|||
require "pry" | |||
binding.pry |
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.
please please please! Take all the binding.pry
's out of your code before submission!
@@ -0,0 +1,99 @@ | |||
# This is our data structure | |||
pool = ["A"] * 9 + ["B"] * 2 + ["C"] * 2 + ["D"] * 4 + ["E"] * 12 + ["F"] * 2 + ["G"] * 3 + ["H"] * 2 + ["I"] * 9 + ["J"] * 1 + ["K"] * 1 + ["L"] * 4 + ["M"] * 2 + ["N"] * 6 + ["O"] * 8 + ["P"] * 2 + ["Q"] * 1 + ["R"] * 6 + ["S"] * 4 + ["T"] * 6 + ["U"] * 4 + ["V"] * 2 + ["W"] * 2 + ["X"] * 1 + ["Y"] * 2 + ["Z"] * 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.
this is the first time I've seen this done in this way, and it's ingenious!
# WAVE#1 | ||
def draw_letters | ||
letters_in_hand = POOL | ||
return letters_in_hand.sample(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 is ostensibly the same as doing:
return POOL.sample(10)
hand_hash[letter] -= 1 | ||
letter_check << "True" | ||
elsif hand_hash[letter] == 0 | ||
letter_check << "False" |
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.
As soon as you fail to find one of the letters, you can bail! just return false
right the heck here!
score += score_chart[letter] | ||
end | ||
|
||
if word_array.length == 7 || word_array.length == 8 || word_array.length == 9 || word_array.length == 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.
All these ||
in here makes it hard to read. You can do this with two comparisons, what are they?
if word_array.length >= 7 && word_array.length <= 10
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerable
mixin? If so, where and why was it helpful?