Skip to content

Conversation

TiffanyChio
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 the parameters. The block that does the computations. The return value. To call the method we need the method call with arguments passed in.
What are the advantages of using git when collaboratively working on one code base? Git has a record of the changes made and a copy of the code at the time of each commit. It allows for easy collaboration because you are able to get consistently updated versions of the code.
What kind of relationship did you and your pair have with the unit tests? We looked to the unit tests to get a better idea of the project requirements. We would run the tests and based on the failures listed we would edit our code for misses in order to make the tests pass.
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? We used enumerables primarily in the highest_score_from method. It reduced the amount of code we had to write to get the program to work and it also has the benefit of simplifying the code for others to read.
What was one method you and your pair used to debug code? We used pry to figure out what was being stored in variables. In particular we had trouble with wave 2 uses_available_letters method. We didn't realize that we were permanently altering our hand array until we stepped through the 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? We discussed the difference in our approach to giving and receiving feedback. Tiffany identified more with ask culture and Alice identified more with guess culture. However it didn't really impact how we worked together. We both weren't afraid to offer suggestions and we were both open to feedback.

require "csv"

def draw_letters()
letter_pool = ["A"] * 9 + ["B"] * 2 + ["C"] * 2 + ["D"] * 4 + ["E"] * 12 + ["F"] * 2 + ["G"] * 3 + ["H"] * 2 + ["I"] * 9 + ["J"] + ["K"] + ["L"] * 4 + ["M"] * 2 + ["N"] * 6 + ["O"] * 8 + ["P"] * 2 + ["Q"] + ["R"] * 6 + ["S"] * 4 + ["T"] * 6 + ["U"] * 4 + ["V"] * 2 + ["W"] * 2 + ["X"] + ["Y"] * 2 + ["Z"]

Choose a reason for hiding this comment

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

Consider using a data structure to store the letter distribution information. You can then use this data structure to create your array.

letter_counts = {"A"=>9, "B"=>2,...}

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

Choose a reason for hiding this comment

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

While this case statement works, it means that the information about which letter has which score is locked into this piece of code, and can't easily be used elsewhere. For example, if you wanted to display the value of each letter in a hand, you would need to repeat this work.

An alternative approach would be to store the letter scores in a hash, something like this:

LETTER_SCORES = {
  "A" => 1
  "B" => 3,
  "C" => 3,
  "D" => 2,
  # ...
}

Then to get the score for a letter, you can say LETTER_SCORES[letter].

word_score << { word: word, score: score_word(word) }
end

max = word_score.max_by { |element| element[:score] }[:score]

Choose a reason for hiding this comment

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

You've packed lots of logic in a few lines of elegant code. Consider adding a few comments that outline the rules for determining the winner, particularly the tiebreaker logic.

@beccaelenzil
Copy link

Adagrams

What We're Looking For

Feature Feedback
General
Answered comprehension questions yes
Small commits with meaningful commit messages yes -- consider committing a little more often (you missed wave 3), and providing even more informative commit messages (i.e. what did update in wave 4?)
Code Requirements
draw_letters method
Uses appropriate data structure to store the letter distribution Consider using a hash to store this information and use that hash to create the array.
All tests for draw_letters pass yes
uses_available_letters? method
All tests for uses_available_letters? pass yes
score_word method
Uses appropriate data structure to store the letter scores See comment in code review
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, but they are all optional ways of looking at this code again. Overall, you two have done a great job. Good work!

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