Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaves - Elizabeth + Cloudy #6

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

north108
Copy link

Adagrams

Congratulations! You're submitting your assignment.

Comprehension Questions

Feature Feedback
What are the components that make up a method? def + end, method signature (should there be parameters), code inside the block that does the actual thing you want.
What are the advantages of using git when collaboratively working on one code base? Our work didn't necessitate that because we worked on one machine but we could use git to got back to a pervious changes.
What kind of relationship did you and your pair have with the unit tests? They helped us figure out what we needed to fix to get the code to work!
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? We used .map to put the words into their own string of characters and we used .min to find the word with the least amount of characters.
What was one method you and your pair used to debug code? binding.pry, puts an p's
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 talked about how we would like to receive feedback, we also decided at the beginning if the project what the work flow was going to be like .

@beccaelenzil
Copy link

Adagrams

What We're Looking For

Feature Feedback
General
Answered comprehension questions yes
Small commits with meaningful commit messages yes -- considering adding wave # to your commit messages
Code Requirements
draw_letters method
Uses appropriate data structure to store the letter distribution see code review
All tests for draw_letters pass yes
uses_available_letters? method the check seems redundant
All tests for uses_available_letters? pass yes
score_word method
Uses appropriate data structure to store the letter scores yes
All tests for score_word pass yes
highest_score_from method
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!

I'm making a few comments on this assignment about some suggestions on how to refactor. In particular, I call attention to some redundant code, suggest a way you can store letter frequency information in a data structure, and name your variables meaningfully to increase readability. Overall, you two have done a great job. Good work!

return letters_in_hand
end

ARRAY_OF_LETTERS = ["A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "C", "C", "D", "D", "D", "D", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "F", "F", "G", "G", "G", "H", "H", "I", "I", "I", "I", "I", "I", "I", "I", "I", "J", "K", "L", "L", "L", "L", "M", "M", "N", "N", "N", "N", "N", "N", "O", "O", "O", "O", "O", "O", "O", "O", "P", "P", "Q", "R", "R", "R", "R", "R", "R", "S", "S", "S", "S", "T", "T", "T", "T", "T", "T", "U", "U", "U", "U", "V", "V", "W", "W", "X", "Y", "Y", "Z"]

Choose a reason for hiding this comment

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

It's advisable to store the frequency information in a hash, and then use that hash to create an array. Also, it's best to put this global at the top of your script.

letter_counts = {
  "A"=>9, "B"=>2, ...
}
letters = []
letter_counts.each do |letter, count|
  count.times do
    letters << letter
  end
end

end
end

check = 0

Choose a reason for hiding this comment

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

This check seems redundant. The first loop will return false if a letter in the word is not in the hand. If that return doesn't happen, you can simply return true after that loop is finished.

"A" => 1, "B" => 3, "C" => 3, "D" => 2, "E" => 1, "F" => 4, "G" => 2, "H" => 4, "I" => 1, "J" => 8, "K" => 5, "L" => 1, "M" => 3, "N" => 1, "O" => 1, "P" => 3, "Q"=> 10, "R"=> 1, "S" => 1, "T" => 1, "U" => 1, "V" => 4, "W" => 4, "X" => 8, "Y" => 4, "Z" => 10
}
word_array = word.upcase.chars
word_points = word_array.map do |k, v|

Choose a reason for hiding this comment

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

Use meaningful names for k and v (i.e. letter and letter_value).

word_points = word_array.map do |k, v|
letter_points[k]
end
total_points = word_points.sum

Choose a reason for hiding this comment

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

Consider using the .sum enumerable to combine the map and sum operations your perform.

return highest_score_hash
end

def tiebreaker_length (old_word, new_word)

Choose a reason for hiding this comment

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

Great use of a helper method. You could consider putting more of the tiebreaker functionality into this method.

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