Amber Lynn/Barbara W., Edges, Adagrams.rb#10
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 |
| 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.
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.
In this method, you all create testing_array to represent an array of booleans (trues or falses) 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?
| end | ||
|
|
||
| testing_array = [] | ||
| editted_letters_drawn = letters_drawn_input |
There was a problem hiding this comment.
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
Enumerablemixin? If so, where and why was it helpful?