Skip to content

Conversation

@kdow
Copy link

@kdow kdow commented Feb 23, 2019

Adagrams

Congratulations! You're submitting your assignment.

Comprehension Questions

Feature Feedback
What are the components that make up a method? The components that make up a method are: the name of the method, arguments (values that are passed), code block, and return value.
What are the advantages of using git when collaboratively working on one code base? To track changes and easily work on different computers by pulling the code that was pushed.
What kind of relationship did you and your pair have with the unit tests? We had a good relationship with the unit tests. We found them useful for knowing what needed more work and when to move on.
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? Yes, we used max_by and min_by. We used max_by to find the word with the highest score, and min_by to find the shortest word in case of a tie.
What was one method you and your pair used to debug code? We used VS Code's debugger to track variables, types, etc.
What are two discussion points that you and your pair discussed when giving/receiving feedback from each other that you would be willing to share? We found it helpful to have our pair to keep us on track when one of us was mentally drained, the other would keep things moving. We also found it helpful to have our partner to come up with ideas for debugging.

scored_words << {:word => word, :score => score_word(word)}
end

highest_scored_word = scored_words.max_by do |scored_words|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scored_words here does a weird thing to your scored_words from line 93. Make sure to check your error messages before you submit your code! https://en.wikipedia.org/wiki/Variable_shadowing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could easily avoid this by calling the line thusly:

highest_scored_word = scored_words.max_by do |word|

end

if highest_score_array.length > 1
highest_scored_word = highest_score_array.min_by { |words| words[:word].length }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, this words variable is shadowing something. This one not causing any harm, but it CAN do really weird and bad stuff. In the same scope, try to use unique names.

letter_pool = make_letter_pool(letter_pool, "H", 2)
letter_pool = make_letter_pool(letter_pool, "I", 9)
letter_pool = make_letter_pool(letter_pool, "J", 1)
letter_pool = make_letter_pool(letter_pool, "K", 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this formatting makes this any easier to read. This takes up more space than a loop would have, and more space than hard-coding an array would have.

10.times do
curr_letter = letter_pool.sample
user_hand.push(curr_letter)
available_letters.delete(curr_letter)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This letter generation method will never result in duplicate letters, because the .delete method deletes all of the curr_letter in the array.

input_letters = input.chars
input_letters.each do |letter|
if letters_in_hand.include?(letter)
letters_in_hand.delete(letter)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never got caught because of draw letters, but this code would break for sets with duplicate letters, because .delete removes duplicates.

@dHelmgren
Copy link

Adagrams

What We're Looking For

Feature Feedback
General
Answered comprehension questions yes
Both teammates contributed to the codebase Yes
Small commits with meaningful commit messages Yes
Code Requirements
draw_letters method See comment!
Uses appropriate data structure to store the letter distribution Yes!
All tests for draw_letters pass Yes
uses_available_letters? method See Comment!
All tests for uses_available_letters? pass Yes
score_word method Yes
Uses appropriate data structure to store the letter scores Yeah
All tests for score_word pass Yes
highest_score_from method Yes
Appropriately handles edge cases for tie-breaking logic Yes
All tests for highest_score_from pass Yes
Overall Hey y'all! Great work on this project. Your code fulfills all of the requirements and does it in a readable and reasonable way. The code is clean, and it passes all the tests! Take a look at the comments, as there are a few sneaky bugs that got through the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants