Conversation
AdagramsWhat We're Looking For
|
kaidamasaki
reviewed
Mar 1, 2019
| LETTER_ARRAY = ["A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "C", "C", "D", "D", "D", "D", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "F", "F", "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"] | ||
|
|
||
| def draw_letters | ||
| letter_array = LETTER_ARRAY.clone |
There was a problem hiding this comment.
Good catch on needing to clone the array!
| def uses_available_letters?(input, letters_in_hand) | ||
| input_array = input.upcase.split("").uniq | ||
| input_array.each do |letter| | ||
| return false if input.count(letter) > letters_in_hand.count(letter) |
There was a problem hiding this comment.
Nice use of returning out of the middle of a .each and of trailing if.
| return points | ||
| end | ||
|
|
||
| def highest_score_from(words) |
There was a problem hiding this comment.
I really like your use of Enumerable methods in highest_score_from your code is really clear and elegant.
| def is_in_english_dict?(input) | ||
| CSV.foreach("assets/dictionary-english.csv") do |row| | ||
| return true if row[0] == input.downcase | ||
| end |
There was a problem hiding this comment.
This is clear and works but causes noticeable lag every time a word is entered.
Can you think of a way to only read assets/dictionary-english.csv once?
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?