-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fire - Jing & Stacy #10
base: master
Are you sure you want to change the base?
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.
Nice work, you hit the learning goals here. Well done.
##################### wave 1 | ||
def draw_letters |
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.
👍
def uses_available_letters?(input, letters_in_hand) | ||
input_letters = input.split("") | ||
if input_letters.length > 10 | ||
puts "Oops, too many letters! You only have 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.
You don't need to do puts
here. Just return false or raise an error. Probably raising an error makes sense here.
puts "Oops, too many letters! You only have 10 :)" |
|
||
counts_input.each_pair do |letter, count| | ||
if counts_input[letter].length > counts_letterinhand[letter].length | ||
puts "Looks like you use #{letter} too many times." |
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.
puts "Looks like you use #{letter} too many times." |
counts_input = input_letters.group_by {|letter| letter} | ||
counts_letterinhand = letters_in_hand.group_by {|letter| letter} |
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.
Clever use of group_by
end | ||
|
||
############################# wave 3 | ||
def score_word(word) |
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.
👍
######################### wave 4 | ||
def highest_score_from(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.
Nice uses of select
and max_by
.
######################### wave 5 | ||
def is_in_english_dict?(input) |
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.
Well done, you got the optional dictionary!
Assignment Submission: Adagrams
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
Enumerable
mixin? If so, where and why was it helpful?