Open
Conversation
AdagramsWhat We're Looking For
|
dHelmgren
reviewed
Aug 23, 2018
| G G G H H I I I I I I I I I J K L L L L M M N N N N N N O O O O O O O O P P | ||
| Q R R R R R R S S S S T T T T T T U U U U V V W W X Y Y Z ] | ||
|
|
||
| return (all_letters.shuffle).first(10) |
dHelmgren
reviewed
Aug 23, 2018
| if hand_copy.include?(alphabet) | ||
| hand_copy.delete_at(hand_copy.index(alphabet)) | ||
| else | ||
| value = false |
There was a problem hiding this comment.
Why wait until the loop is finished to return this false? If the first element fails, is there any reason to keep checking?
dHelmgren
reviewed
Aug 23, 2018
| word_array = word.upcase.split('') | ||
| scores = word_array.map do |letter| | ||
| score_hash[letter] | ||
| end |
There was a problem hiding this comment.
A different enumerable would allow you to do this with only one loop! Think about how inject/reduce could be used here.
dHelmgren
reviewed
Aug 23, 2018
|
|
||
| best_word_list = words_with_scores.select{|word, score| score == best_score} | ||
|
|
||
| best_word = 'reallybigtestword' |
There was a problem hiding this comment.
This shouldn't stay in your final code! Write a case to handle when there is not a current best word, rather than relying on the first entry in best_word_list being overwritten.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerablemixin? If so, where and why was it helpful?