Skip to content

Conversation

@lebaongoc
Copy link

Adagrams

Congratulations! You're submitting your assignment.

Comprehension Questions

Feature Feedback
What are the components that make up a method? A method signature which can have parameters and a return statement.
What are the advantages of using git when collaboratively working on one code base? Git allows multiple people to work on one project in a reliable and efficient way. It allows collaborators to implement changes and identify conflicts as needed.
What kind of relationship did you and your pair have with the unit tests? We found them to be very helpful and we rely on them to ensure that our program is working the way it is intended.
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? We used .include? & .min_by. Enumerable methods were helpful because they allow us to reduce the amount of code that we have to write to solve the problem.
What was one method you and your pair used to debug code? We raked through our program often and refactored our codes until the tests passed.
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 brought up the importance of celebrating small victories. They gave us a sense of accomplishment and motivated us to keep acing the project. 2. We also know when to take a step back and ask for help. This allows us to use our time efficiently and complete the project on time.

@tildeee
Copy link

tildeee commented Mar 1, 2019

Adagrams

What We're Looking For

Feature Feedback
General
Answered comprehension questions x
Both teammates contributed to the codebase x
Small commits with meaningful commit messages x
Code Requirements
draw_letters method x
Uses appropriate data structure to store the letter distribution x
All tests for draw_letters pass x
uses_available_letters? method x
All tests for uses_available_letters? pass x
score_word method x
Uses appropriate data structure to store the letter scores x
All tests for score_word pass x
highest_score_from method x
Appropriately handles edge cases for tie-breaking logic x
All tests for highest_score_from pass x
Overall

Well done on this project, you two!

Your code handles the logic well and accurately, and I like the use of Enumerable methods you got to put in. The tests all pass, and your code is readable, so I'm very happy with this submission.

I have a few comments, but in general, I think your code looks great. Good work!

9.times do
letter_pool << "A"
letter_pool << "I"
end
Copy link

Choose a reason for hiding this comment

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

I like this strategy of using times to populate the letter_pool

letter_pool << "O"
end

letter_pool.sort!
Copy link

Choose a reason for hiding this comment

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

I like that you sorted, and you did it with the ! which is great! Technically, it shouldn't actually matter if you sort it though, since it's all random anyway

return rand_letter
end

letters_in_hand = draw_letters
Copy link

Choose a reason for hiding this comment

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

Since this is library code, you'll want to delete this line, since it doesn't get used or run anywhere (or at least, doesn't get used by the tests!)


letters_in_hand = draw_letters

user_input = gets.chomp
Copy link

Choose a reason for hiding this comment

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

Same as above: this line doesn't ever get executed, so it's okay to remove this line

return true
else
return false
end
Copy link

Choose a reason for hiding this comment

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

Nice! Very clean logic

n = scores.length
winning_word_array = []

(0..n - 1).each do |n|
Copy link

Choose a reason for hiding this comment

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

Outside of this loop, n means the total number of scores/words, and inside, n means the number. It might help to have a more descriptive name for n outside the loop

winning_word = word
break
else
winning_word = winning_word_array.min_by { |word| word.length }
Copy link

Choose a reason for hiding this comment

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

I like your code as is. However, if you wanted to do some extreme optimization: Let's say that winning_word_array was an array of 5 items. Let's say that all 5 items a length of less than 10 (so they would end up in this else block.) winning_word ends up being re-assigned all 5 times because this each loop gets us here, and the value of winning_word never changes because of this winning_word_array.min_by call... so it's a little redundant. A possible refactoring to get this super fancy would be to change the logic so it doesn't do that. :)

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.

2 participants