Branches - Clara & Kelsey#16
Conversation
AdagramsWhat We're Looking For
Great work on this project, you two! I'm really pleased with the code I see here; it's clean, logical, readable, and does some really cool things. I have a few suggestions on how to make Ruby like your code style a little more. Other than that, overall, great submission. Also, great work on the optionals! |
| { character: "x", quantity: 1, score: 8 }, | ||
| { character: "y", quantity: 2, score: 4 }, | ||
| { character: "z", quantity: 1, score: 10 }, | ||
| ] |
There was a problem hiding this comment.
This data structure RULES! It's so clear what each value is! Nice
| end | ||
| # restores the "used" letters to letter_bucket so they are not "used up" | ||
| letter_bucket << hand | ||
| letter_bucket.flatten!.sort! |
There was a problem hiding this comment.
Turns out: You don't need these two above lines! You would need them if you did need to manually restore the letter_bucket value, but because of variable scope, every time that this method gets called, letter_bucket gets recreated to its original form.
| end | ||
| end | ||
| # the length of the input checks that the user used only available letters | ||
| if input.length == 0 |
| return true | ||
| else | ||
| return false | ||
| end |
There was a problem hiding this comment.
There's an opportunity to refactor here. Consider instead of this if ... else statement:
return input.length == 0 ? true : falseor even...
return input.length == 0| # wave 3 | ||
|
|
||
| # manipulate user input | ||
| def score_word (word) |
There was a problem hiding this comment.
Minor nitpick: You CAN define a method with a space between the method name and the input parens, but Ruby will give a warning, because it prefers it if the method signature looks more like def score_word(word)
| end | ||
| end | ||
|
|
||
| return winning_hash |
There was a problem hiding this comment.
Extremely minor: You lost your indentation on this line! Watch out!
|
|
||
| # checks to see if input is in English dictionary | ||
| def is_in_english_dict? (input) | ||
| path = '/Users/kelseykrippaehne/Documents/Ada/hw/adagrams/lib/dictionary-english.csv' # deliberate absolute path |
There was a problem hiding this comment.
We talked this through together in person BUT just wanted to share that to make it work on my machine, changing this line to path = 'lib/dictionary-english.csv' worked for me since y'all moved the file, but I didn't get it to work to go to the assets folder
|
|
||
| it 'actual word is recognized by English dictionary' do | ||
| drawn_letters = ['T', 'H', 'E', 'A', 'R', 'C', 'H', 'I', 'C', 'X'] | ||
| test_word = 'THEARCHIC' |
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerablemixin? If so, where and why was it helpful?