-
Notifications
You must be signed in to change notification settings - Fork 33
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
Branches - Clara & Kelsey #16
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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! This is clever!!!
return true | ||
else | ||
return false | ||
end |
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.
There's an opportunity to refactor here. Consider instead of this if ... else
statement:
return input.length == 0 ? true : false
or even...
return input.length == 0
# wave 3 | ||
|
||
# manipulate user input | ||
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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' |
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.
whoooooa :0
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerable
mixin? If so, where and why was it helpful?