Skip to content

Conversation

@evelynnkaplan
Copy link

Adagrams

Congratulations! You're submitting your assignment.

Comprehension Questions

Feature Feedback
What are the components that make up a method? The method signature (possibly including parameters) and the block.
What are the advantages of using git when collaboratively working on one code base? The ability to make changes on more than one computer and update the master file with changes from any computer. The logging of change history is also an advantage.
What kind of relationship did you and your pair have with the unit tests? After we realized that we were not writing a full program and instead writing methods to pass tests, the tests were very helpful because we were able to refactor the code in our methods to pass the tests.
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? We used .all? and .include? to validate that the input used available letters from the user's hand.
What was one method you and your pair used to debug code? We used the VSCode debugger and we used pry.
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? 1. We felt comfortable expressing ourselves to each other - whether it was frustration with a code error, celebration, or one of us needing a short mental break, and felt that the other respected those expressions. 2. Our pair programming workflow often lacked concrete "driver/navigator" roles. We didn't feel that this lack hindered our workflow, however, and think that this lack occurred mostly due to the fact that much of our coding time was spent stuck over problems with errors and test failures, so there wasn't a lot of opportunity for one or the other to confidently drive or navigate for an extended period of time.

@kaidamasaki
Copy link

Adagrams

What We're Looking For

Feature Feedback
General
Answered comprehension questions
Small commits with meaningful commit messages
Code Requirements
draw_letters method
Uses appropriate data structure to store the letter distribution
All tests for draw_letters pass
uses_available_letters? method
All tests for uses_available_letters? pass
score_word method
Uses appropriate data structure to store the letter scores
All tests for score_word pass
highest_score_from method
Appropriately handles edge cases for tie-breaking logic Mostly
All tests for highest_score_from pass
Overall Good job! There were a few small issues but overall the code was clean and with good variable names.

@@ -1,0 +1,125 @@
def draw_letters
letter_distribution = {

Choose a reason for hiding this comment

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

In the future consider defining something like letter_distribution outside of the method as a constant.

LETTER_DISTRIBUTION = { 
  # ...
}

def draw_letters

Using a constant isn't always going to be the right call but it's worth thinking about. For example, it's fine here because this data is just from a hash but if it was loaded from a file or something it might be worth only creating it once.

Choose a reason for hiding this comment

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

I like the format you used here, though. I think having the letter to go its number of occurrences is really readable.

letter_pool = []
letter_distribution.each do |str, n|
n.times do
letter_pool << str.downcase

Choose a reason for hiding this comment

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

When you compute something like this in a method you should think about whether or not it should be a constant. Here it's perfectly reasonable to write the method this way but it's worth keeping in mind.

If it's expensive to compute (like, if it needs to read from a file) then you may want to store it once instead of generating it multiple times.

def uses_available_letters?(input, letters_in_hand)
if input.length > 10
puts "Too many letters! Try again: "
input = gets.chomp.downcase

Choose a reason for hiding this comment

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

You shouldn't be handing input from the user here. The wave-N-game should handle that for you.

The reason for this is that it's tricky to test code that asks for user input so it's nice to have that all in one place.

word.each_char do |letter|
total_points += (score_chart[letter])
end
return total_points

Choose a reason for hiding this comment

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

I like how concise this method is. 😃

if word.length == 10 && !(word.length == winning_word[:word].length)
winning_word[:word] = word.upcase
elsif word.length == 10 && (word.length == winning_word[:word])
winning_word[:word].downcase = winning_word[:word].downcase

Choose a reason for hiding this comment

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

I think you meant:

Suggested change
winning_word[:word].downcase = winning_word[:word].downcase
winning_word[:word] = winning_word[:word].downcase

The code you have produces a NoMethodError.

puts "Too many letters! Try again: "
input = gets.chomp.downcase
end
if (input.chars.all? { |char| letters_in_hand.include? char })

Choose a reason for hiding this comment

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

Nice use of .all?!

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