-
Notifications
You must be signed in to change notification settings - Fork 27
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
Trang & Cassy - Adagram #7
base: master
Are you sure you want to change the base?
Conversation
AdagramsWhat We're Looking For
|
# Validating quantitiy | ||
input.chars.each do |letter| | ||
if input.count(letter) > letters_in_hand.count(letter) | ||
letter_results << 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 know one is false, do you need to see the rest of the letters?
end | ||
end | ||
# Returns true if input quantity is valid | ||
return letter_results.all?(true) |
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 hiding a second loop from you!
if length_of_10.length > 0 | ||
# Returning first word/score in the length_of_10 array | ||
return { :word => length_of_10[0][:word], :score => length_of_10[0][:score]} | ||
else |
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.
The logic after here is kind of hairy, could have benefited from a longer comment.
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerable
mixin? If so, where and why was it helpful?