-
Notifications
You must be signed in to change notification settings - Fork 27
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
Amber Lynn/Barbara W., Edges, Adagrams.rb #10
base: master
Are you sure you want to change the base?
Conversation
… but only 15/16 test pass
AdagramsWhat We're Looking For
Hi all! Actually, to get your code to run the tests, I did the following:
With those two changes, I got all of the tests to pass except for four -- and they weren't very far off. That being said -- I am so sorry that you all misunderstood the assignment requirements and wrote the game code! Please let us know how to make it more clear, and take care to follow the project requirements. If it isn't clear at this moment: we really just want you all to implement code within methods now. The code in the methods will be run and tested through the tests alone. I think otherwise the code is good. All of the methods get the answers we're looking for... The only failing tests I see are for There are some areas of code that, when given a set of fresh eyes, I think you will see can be refactored to do the same work, but with a simplified approach. I'll leave some comments for that. Good work nonetheless |
lib/adagrams.rb
Outdated
else | ||
if number_of_winning_words_of_min_length == 1 | ||
|
||
final_winner_hash[:word] = all_winning_words_of_shortest_length |
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.
Here, you are assigning into final_winner_hash[:word]
the value of the entire array all_winning_words_of_shortest_length
... even if this array is one element long, you'll still want to take it out of this array with all_winning_words_of_shortest_length.first
or all_winning_words_of_shortest_length[0]
.
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.
In this method, you all create testing_array
to represent an array of booleans (true
s or false
s) for each letter if the letter was found... if the letter was not found, you put into testing_array
a false
value.
In the end, you ask if testing_array.all?
, which asks, "if the testing array is all true values, this is true".
We know that using return
will stop a method and return a value. Specifically, we know that if a code reaches a line and executes return false
, it will stop proceeding into the method and get out of the method and return false
.
What if instead of approaching this problem with "Let's get an array of trues and falses, and if there's a false, then the answer "uses_available_letters?" is false"... We approach it with, "if we need to shovel in false
into testing_array
once, then we know that the answer is false
"?
For example, on line 53, you all wrote testing_array << false
. Is there any case in which shoveling false
into testing_array
does not mean that the method should return false overall?
lib/adagrams.rb
Outdated
end | ||
|
||
testing_array = [] | ||
editted_letters_drawn = letters_drawn_input |
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.
you are assigning the value of letters_drawn_input
into a new local variable editted_letters_drawn
. Is there a reason why you couldn't just keep using letters_drawn_input
?
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerable
mixin? If so, where and why was it helpful?