-
Notifications
You must be signed in to change notification settings - Fork 33
Leaves - Dianna and Sabrina #1
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?
Conversation
AdagramsWhat We're Looking For
|
number.times do | ||
tile_array.push(letter.to_s) | ||
end | ||
end |
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 a very neat solution to the problem here!
def uses_available_letters?(input, letters_in_hand) | ||
user_string = input.upcase | ||
letters_to_check = letters_in_hand.dup | ||
user_string.length.times do |i| |
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.
Any reason you're using a times do
instead of an each do
?
word.length.times do |i| | ||
letter = word[i].upcase | ||
score_total += score_hash[letter.to_sym] | ||
end |
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.
You should get used to the .each
loop syntax! This loop becomes much easier to read with it!
word.each do |letter|
score_total += score_hash[letter.upcase.to_sym]
end
highest_words.each do |word| | ||
if word.length == 10 | ||
winning_word = word | ||
break |
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.
If you already know this is the winner, don't bother with break
, just return
!
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
def
keyword, a method name, zero or more parameters, a block, and anend
keyword.Enumerable
mixin? If so, where and why was it helpful?.min_by
to find the word with the shortest length in our list of highest-scoring words. It was helpful because it returned the first item even if there was a tie.