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 - Kristina and Julia #15

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

Conversation

Kalakalot
Copy link

Adagrams

Congratulations! You're submitting your assignment.

Comprehension Questions

Feature Feedback
What are the components that make up a method? the signature, the parameter(s), and if you're calling a method, the arguments
What are the advantages of using git when collaboratively working on one code base? Git provides version control and allows you to add notes when you are making changes, which is helpful for your team members (and yourself). Git also shows who made which changes, and provides ability to compare differences.
What kind of relationship did you and your pair have with the unit tests? A challenging one: it took us a while to figure out how the tests fit with our code and the driver code, but once we understood, tests made finding errors and pinpointing what was wrong much easier.
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? We successfully used .max to find the highest-scoring word. We tried to implement .select to help us with tie-breaking for equally scoring words (wave 4), but we ran out of time and brainpower.
What was one method you and your pair used to debug code? We used the errors and stack trace from tests to determine where errors in our code originated.
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 learning styles (very similar) and we also checked in about emotions frequently, which helped us understand where the other person was coming from. We bonded over lack of sleep and bad but funny jokes.

@dHelmgren
Copy link

Adagrams

What We're Looking For

Feature Feedback
General
Answered comprehension questions Yes
Small commits with meaningful commit messages yes
Code Requirements
draw_letters method
Uses appropriate data structure to store the letter distribution yes, but see comments
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 yes
All tests for score_word pass No, see comments.
highest_score_from method
Appropriately handles edge cases for tie-breaking logic yes
All tests for highest_score_from pass yes
Overall Good work on this, though some of your tests are failing. I left a few comments around this code. Your process right now is solid, and has gotten you to many correct answers. However, you end up repeating your work a bunch, or doing things with more lines of code than you need. Checking in with the documentation to find just the right method is a really clutch skill that can sometimes save hours of work. As we progress in the curriculum, focus on making sure your fundamentals are sharp, and that you check and recheck your mental toolbox for the right built-in tools.

letters_in_hand = []

10.times do |letter|
letter = remaining_pool.sample

Choose a reason for hiding this comment

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

There is another version of sample! It might help you DRY up this code.


# Wave one method
def draw_letters
remaining_pool = %w(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.

Why do we redo the work of line 3 here?



# Wave 2: uses_available_letters?
# Need to review lines 57-67, b/c failing test for returning true if the submitted letters are valid against the drawn letters

Choose a reason for hiding this comment

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

This comment should come out before submission!


input_array.each do |letter|
unless letters_in_hand.include?(letter)
return false

Choose a reason for hiding this comment

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

You end up repeating this work down below.


# making a hash from user_input with letters as keys and counts as values
input_hash = {}
input_array.each do |letter|

Choose a reason for hiding this comment

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

I think making a second hash complicates this a lot. What if you just used the input string to count down the number of letters from letters_hand_hash?

end

# If the length of word is between 7-10, add 8 points to the total score
if input_array.length == 7 || input_array.length == 8 || input_array.length == 9 || input_array.length == 10

Choose a reason for hiding this comment

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

You can reduce the amount of work you are doing here! It's possible to do this line with only 2 comparisons. What are they?

if input_array.length >= 7 && input_array.length <= 10

# Calculating the sum for all the letters in word
sum = 0
scores.each do |score|
sum = sum + score

Choose a reason for hiding this comment

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

If you're trying to end up with a sum, why make an array and then convert that array into a bunch of letters? You can just add up all the letter scores as you go!


words.each do |word|
word_letters = word.chars #convert string to array of characters
word_length = word_letters.length #count the length of characters

Choose a reason for hiding this comment

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

You added a step here. word.length is a valid string operation!


# determine which word has the highest score and return associated word
highest_score = word_scores.max

Choose a reason for hiding this comment

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

You currently have 2 failing tests. The code that will fix them goes here. You need to either 1) prefer the shortest word or 2) prefer the word that uses all 10 letters, depending on input.

@@ -0,0 +1,174 @@
require 'pry'

letter_pool = %w(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.

looks like you have two versions of this file. was that intentional?

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