Fire - Noor and Anna - #17
Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
Overall not bad. You hit the main learning goals here. However check out my comments on highest_score_from. I'm not convinced it works in all cases.
| .floo | ||
| .flooignore |
| @@ -0,0 +1,129 @@ | |||
|
|
|||
| LETTERS = { | |||
There was a problem hiding this comment.
Nice way to set up the distribution of letters.
| } | ||
|
|
||
| # WAVE 1 | ||
| def draw_letters() |
|
|
||
| # WAVE 2 | ||
|
|
||
| def uses_available_letters?(input, letters_in_hand) |
|
|
||
| # Wave 3 | ||
|
|
||
| def score_word(word) |
| return hash | ||
| elsif length < 10 | ||
| min_length = word_lengths.min | ||
| hash[:word] = words[word_lengths.index(min_length)] |
There was a problem hiding this comment.
This might not work in all cases. What if there is a non-winning word with an equal length
There was a problem hiding this comment.
Ah I see! Because we are checking through all the words that are passed as an argument, when we should be looking at the subset that has the highest points - is that right?
| hash[:word] = words[word_lengths.index(length)] | ||
| hash[:score] = points[word_lengths.index(length)] | ||
| return hash |
There was a problem hiding this comment.
You don't know if the word with length 10 is tied for the highest score here.
|
|
||
| # Wave 4 | ||
|
|
||
| def highest_score_from(words) |
There was a problem hiding this comment.
I am uncertain that this method will work in all cases. See my comments below.
Assignment Submission: Adagrams
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
Enumerablemixin? If so, where and why was it helpful?