Skip to content

Conversation

@gracemshea
Copy link

Adagrams

Congratulations! You're submitting your assignment.

Comprehension Questions

Feature Feedback
What are the components that make up a method? Method Signature which includes: def, method name, parameters. This is followed by a block of code.
What are the advantages of using git when collaboratively working on one code base? It allows for much easier version control and prevents us from overriding each other's work when editing from different machines.
What kind of relationship did you and your pair have with the unit tests? For each method, we started with the tests failing, and accomplished the revisions necessary to make it pass. And then we proceeded to the next method!
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? We did. We used the reduce method in our word_score section (Line 58). It allowed us to succinctly add together the scores of different characters as we iterated through the words.
What was one method you and your pair used to debug code? We used binding.pry to access the values of variables at break points.
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 were both comfortable stopping the other when we needed to slow down or clarify a question. We discussed our communication styles and while we work very well together - we did discuss how we would approach working with "guess" communication styles.

@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 Yes
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 Yes, also, Nice Memo!
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!

}

avail_letters = array_gen(letter_freq)
used_letters = avail_letters.sample(10)

Choose a reason for hiding this comment

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

This is lovely! I can see everything I need to see about how this works, and if I get confused about array_gen it's close at hand!

end
if input.length > letters_in_hand.length
return false
else

Choose a reason for hiding this comment

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

Small semantic note: If you don't return above or raise, then you won't hit the code in this else anyway. In cases like this, it's nice to leave the meat of the method outside of an else block.

possible_letters = letters_in_hand.clone
input.upcase.split(//).each do |char|
if possible_letters.include?(char)
possible_letters.delete(char)

Choose a reason for hiding this comment

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

You will never return true for a word with a repeated letter. For example,
ruby hand = ["E", "F", "R", "A", "E", "L", "V", "A", "D", "K"] uses_available_letters?("ADA", hand) # => false
The reason why is that Ruby's Array#delete method will remove all matching elements from an array, not just the first match.

Copy link

@shubha-rajan shubha-rajan Mar 5, 2019

Choose a reason for hiding this comment

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

Good to know!
If we were to write something like:
i = index (char)
possible_letters.delete_at(i)
would it preserve the other repeats of the letter?
And is there a more elegant way of doing it?

if possible_letters.include?(char)
possible_letters.delete(char)
else
return false

Choose a reason for hiding this comment

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

Nice work returning when you have the answer!

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