Skip to content

Conversation

@hanalways
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 is the name of the method and the (optional) parameters of the method. The other component is a block that makes up what the method functions as.
What are the advantages of using git when collaboratively working on one code base? When a teammate/partner makes a change on their local repository, they can push any changes back to the git repository for their teammate to pull and make changes on their own local repository. Git also tracks those changes and comments of those changes so you can easily track the program's progress. Git also alerts you to any discrepancies between your local program and the Git repository.
What kind of relationship did you and your pair have with the unit tests? By Wave 3 we forgot that we were implementing TDD to create our program. We finished the program (Wave 4) without structuring our code around the tests. We both did a good job in identifying discrepancies in our code and the code that was expected from what the test asserts and working top-to-bottom to refactor our code to comply with the tests.
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? We used the each_with_index and include? method in our uses_available_letters? method. Each_with_index was helpful because we wanted to know the index of the letter in our letters_in_hand array that way we could delete the element from the specific index instead of all the instances.
What was one method you and your pair used to debug code? We used the gem pry to debug instances in our code. It was helpful when we invoked it inside our .each loops to track return variables. We also whiteboarded to make sure that concepts were clear before implementing them in our code.
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? The discussion points that were very helpful when pair programming was that Hana tended to outline on a whiteboard new concepts and read all required properties of the code outloud. Nara spearheaded debugging and helped explore and test all possible solutions before implementing the concepts. We both did a good job stepping up when there were times of confusion, and stepping back when there was a good idea presented.

@kaidamasaki
Copy link

kaidamasaki commented Mar 4, 2019

Adagrams

What We're Looking For

Feature Feedback
General
Answered comprehension questions
Both teammates contributed to the codebase
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 Unit tests pass but doesn't work if you run wave-2-game.rb
All tests for uses_available_letters? pass
score_word method
Uses appropriate data structure to store the letter scores Used a case instead of a data structure.
All tests for score_word pass
highest_score_from method
Appropriately handles edge cases for tie-breaking logic
All tests for highest_score_from pass
Overall Overall your project was quite good with just a few little things I would change. However, you had some issues with Wave 2 (try manually testing ruby wave-2-game.rb). It's good that you coded against the tests to get your solution working but remember that tests are never quite perfect and some bugs can still slip through the cracks.

letters_in_hand.each_with_index do |letter, index|
if input_array.include?(letter)
size += 1
letters_in_hand.delete(index)

Choose a reason for hiding this comment

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

Because you delete letters from the hand as you go if a user submits a mostly correct word the letters it used are deleted. For example:

$ ruby wave-2-game.rb
Welcome to Adagrams!
Let's draw 10 letters from the letter pool...
You have drawn the letters:
t, g, e, a, a, s, e, e, a, e
Please input a word that only uses the letters from the letter bank
tget
You entered in a word that contains characters not in the letter bank
Please input a word that only uses the letters from the letter bank
tge
You entered in a word that contains characters not in the letter bank
Please input a word that only uses the letters from the letter bank


def score_word(word)
points = 0
word.upcase.split(//).each do |letter|

Choose a reason for hiding this comment

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

There's a handy .chars method on String that does the same thing as .split(//) but a little clearer, if you want to do this again in the future. 😃

elsif word.length < min_length
min_length = word.length
best_word[:word] = word
best_word[:score] = max_words[:score]

Choose a reason for hiding this comment

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

This is a clever way to find the shortest word in max_words.

end

def highest_score_from(words)
highest_score = Hash.new(0)

Choose a reason for hiding this comment

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

Misleading variable name: highest_score winds up holding all of the scores, not just the highest one(s).


def uses_available_letters?(input, letters_in_hand)
size = 0
input_array = input.upcase.split(//)

Choose a reason for hiding this comment

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

Calling upcase on the user's input is a good idea, however you forgot to call upcase on the letters in letters_in_hand which means that if you are passed lowercase letters you won't have any matches.

You could add this to fix it:

letters_in_hand = letters_in_hand.map { |l| l.upcase }

input_array = input.upcase.split(//)

letters_in_hand.each_with_index do |letter, index|
if input_array.include?(letter)

Choose a reason for hiding this comment

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

This is really close to right. Because of the way the above loop is implemented this winds up requiring the user to use all of a given letter. If you input_array.each and letters_in_hand.include? then this works perfectly.

end
end

if size == input_array.length

Choose a reason for hiding this comment

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

This works but having to keep track of size is a little awkward.

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.

4 participants