Leaves - Yitgop & Bri#19
Open
rinostar wants to merge 7 commits into
Open
Conversation
added 7 commits
August 12, 2019 17:05
AdagramsWhat We're Looking For
|
dHelmgren
reviewed
Aug 20, 2019
| expect(score_word(words.last)).must_equal 18 | ||
|
|
||
| require "pry" | ||
| binding.pry |
There was a problem hiding this comment.
please please please! Take all the binding.pry's out of your code before submission!
| @@ -0,0 +1,99 @@ | |||
| # This is our data structure | |||
| pool = ["A"] * 9 + ["B"] * 2 + ["C"] * 2 + ["D"] * 4 + ["E"] * 12 + ["F"] * 2 + ["G"] * 3 + ["H"] * 2 + ["I"] * 9 + ["J"] * 1 + ["K"] * 1 + ["L"] * 4 + ["M"] * 2 + ["N"] * 6 + ["O"] * 8 + ["P"] * 2 + ["Q"] * 1 + ["R"] * 6 + ["S"] * 4 + ["T"] * 6 + ["U"] * 4 + ["V"] * 2 + ["W"] * 2 + ["X"] * 1 + ["Y"] * 2 + ["Z"] * 1 | |||
There was a problem hiding this comment.
this is the first time I've seen this done in this way, and it's ingenious!
| # WAVE#1 | ||
| def draw_letters | ||
| letters_in_hand = POOL | ||
| return letters_in_hand.sample(10) |
There was a problem hiding this comment.
this is ostensibly the same as doing:
return POOL.sample(10)
| hand_hash[letter] -= 1 | ||
| letter_check << "True" | ||
| elsif hand_hash[letter] == 0 | ||
| letter_check << "False" |
There was a problem hiding this comment.
As soon as you fail to find one of the letters, you can bail! just return false right the heck here!
| score += score_chart[letter] | ||
| end | ||
|
|
||
| if word_array.length == 7 || word_array.length == 8 || word_array.length == 9 || word_array.length == 10 |
There was a problem hiding this comment.
All these || in here makes it hard to read. You can do this with two comparisons, what are they?
Details
if word_array.length >= 7 && word_array.length <= 10
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?