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

adagrams #4

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

adagrams #4

wants to merge 4 commits into from

Conversation

marks214
Copy link

Assignment Submission: Adagrams

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Feature Feedback
What are the components that make up a method? The method is the code between def and end. A method signature includes the method name and its parameters (if there are any), for example sum(a, b, c). A return exits the method and returns whatever follows it, if nothing follows it, then nil is returned.
What are the advantages of using git when collaboratively working on one code base? By using git we were able both have access to the changes in the files.
What kind of relationship did you and your pair have with the unit tests? The unit tests let us know if our ideas were working or not.
Does your code use any methods from the Enumerable mixin? If so, where and why was it helpful? We used "select" to select/add the correct values to the word_array in wave 3. All? Was helpful because it returns true if all characters were valid.
What was one method you and your pair used to debug code? We ran rake in the terminal and used TDD to get the code to pass the tests. A method we both used was passing test arrays (or strings) and then printing different outputs to the terminal was also helpful.
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? Talking about what one another did well served as an encouraging feedback tool. Overall, approaching the project with positivity and taking time to read and then review the readme and requirements.

Copy link
Collaborator

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Well done Aimee & Ida. You hit the learning goals here. I like the use of Enumerable methods here. It's quite well done and very compact.

@@ -0,0 +1,139 @@
# frozen_string_literal: true

a = Array.new(9) { 'A' }
Copy link
Collaborator

Choose a reason for hiding this comment

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

This method works, but it's pretty long-hand.

Comment on lines +30 to +41
ALPHABET = [a, b, c, d, e, f, g, h, i, j, k, l, m, n,
o, p, q, r, s, t, u, v, w, x, y, z].flatten

SCORE_CHART = [
{ 1 => %w[A E I O U L N R S T] },
{ 2 => %w[D G] },
{ 3 => %w[B C M P] },
{ 4 => %w[F H V W Y] },
{ 5 => %w[K] },
{ 8 => %w[J X] },
{ 10 => %w[Q Z] }
].freeze
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like how you included these constants at the top for reference.

Comment on lines +43 to +47
# wave 1
def draw_letters
ten_letters = ALPHABET.sample(10)
return ten_letters
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Comment on lines +73 to +75
count = letter_frequency[letter]
count += 1
letter_frequency[letter] = count
Copy link
Collaborator

Choose a reason for hiding this comment

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

A little simplification.

Suggested change
count = letter_frequency[letter]
count += 1
letter_frequency[letter] = count
letter_frequency[letter] += 1

Comment on lines +57 to +64
count = letter_count[letter]
if count == 0
false
else
count -= 1
letter_count[letter] = count
true
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

This works, but you can simplify it a bit.

Suggested change
count = letter_count[letter]
if count == 0
false
else
count -= 1
letter_count[letter] = count
true
end
letter_count[letter] -= 1
letter_count[letter] < 0

end

# wave 3
def score_word(word)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍
Really clever use of select, and include?.

Comment on lines +101 to +102
# wave 4
def highest_score_from(words)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

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