Skip to content

Chantelle/Semret - C10 Edges - Adagrams#19

Open
snicodimos wants to merge 14 commits into
Ada-C10:masterfrom
snicodimos:master
Open

Chantelle/Semret - C10 Edges - Adagrams#19
snicodimos wants to merge 14 commits into
Ada-C10:masterfrom
snicodimos:master

Conversation

@snicodimos
Copy link
Copy Markdown

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 return statements
What are the advantages of using git when collaboratively working on one code base? Good documentations of changes pairs made and why. The ability to have merge conflict resolutions and the ease of accessibility of the code for each partner.
What kind of relationship did you and your pair have with the unit tests? Both utilized the old "puts" method to check, slowly incorporated using unit tests and got more comfortable by the end of the project.
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? Yes we used .map and it was helpful to aggregate our letter pool to a single array of possible available letters to draw from.
What was one method you and your pair used to debug code? we inserted "puts" to see what was being produced when using loops to debug 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? Come up with a rule (that includes conflict resolution/eg each gets one veto card) in the beginning and follow them (we had come up with rules/expectations but failed to follow them). Being patient with ourselves and each other and remind ourselves that we're still learning (and we have different learning styles and weaknesses)

@tildeee
Copy link
Copy Markdown

tildeee commented Aug 25, 2018

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

Hi y'all-- good work!

The code is good and meets all the requirements!

Overall, I found it extremely readable, with great names and a great approach to solve the problems.

There are some small areas that I think could be simplified, and I'm making a comment on those, but nothing too big.

Also, nicely done on the optional wave!

Good work on this project!

Comment thread lib/adagrams.rb
random_draw = split_letter_pool.flatten.sample(10)
return random_draw

end
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think overall, your solution to this method is good-- it shows that you all know how to use iteration and specifically map to create an interesting array. My only concern is that I feel like maybe map forced you all to need to make a lot of arrays and a lot of loops-- I don't recommend any changes at this moment, but if you all ever take a minute to look at this problem with fresh eyes, there may be other approaches where it doesn't feel like "fighting" with map

Comment thread lib/adagrams.rb
temp_hand = letter_in_hand.dup
inputted_word = []
inputted_word << word.upcase.split("")
inputted_word.flatten!
Copy link
Copy Markdown

@tildeee tildeee Aug 25, 2018

Choose a reason for hiding this comment

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

Actually, calling word.upcase.split("") will return an array of letters split by each character...

aka, if word is "example", word.upcase.split("") will be ["E", "X", "A", "M", "P", "L", "E"]! You don't need to shovel this array into the empty array inputted_word so it's [["E", "X", "A", "M", "P", "L", "E"]] and then flatten it... you can just assign the result of split into inputted_word!

Therefore, you can turn the above code:

inputted_word = []
inputted_word << word.upcase.split("")
inputted_word.flatten!

to

inputted_word = word.upcase.split("")

Let me know if there are any questions on this

Comment thread lib/adagrams.rb
check_letter = true

inputted_word.each do |letter|
index = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Scope question: What is the smallest scope (the most specific/local block of code) that index needs to be in?

Comment thread lib/adagrams.rb

if temp_hand.include?(letter)
index = temp_hand.index(letter)
temp_hand.delete_at(index)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think that index doesn't get used until this if block, so you may not need to declare index = 0 before this if block. Try deleting the index = 0 above and run the tests to see if it still works!

Comment thread lib/adagrams.rb
# creating a hash to store highest scoring word with its score value
highest_scoring_hash = {
:score => 0,
:word => words.first
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You declare that the initial value of highest_scoring_hash has a value 0 for score and a value of the first word for word. You may want to make the initial value consistent and make the initial value of score equal to score_word(words.first)

Comment thread lib/adagrams.rb
# when lengths are equal picking first (the one already stored in hash)
elsif current_word.length == highest_scoring_hash[:word].length ||
highest_scoring_hash[:word].length == 10
# do nothing
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If you need to do nothing, then you probably don't need to have this elsif exist :)

Comment thread lib/adagrams.rb


results = false
dictionary = CSV.read("assets/dictionary-english.csv",headers: true, header_converters: :symbol)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

good job including headers on this!

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