-
Notifications
You must be signed in to change notification settings - Fork 26
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
Scrabble- Octos- Brandy & Ari! #12
base: master
Are you sure you want to change the base?
Conversation
Merging to account for Wave 2 instructions
…ctions as comments
Merge branch 'master' of https://github.com/Ari-1/Scrabble
…ctions as comments
Merging in attempt to update project instructions
Merging with masted
… still in progress, some comments added
Merge branch 'master' of https://github.com/Ari-1/Scrabble
ScrabbleWhat We're Looking For
Overall you did a nice job with this assignment. There are a few things you can clean up but you demonstrated practice with the major learning goals. |
letters_groups.each_with_index do |group, index| | ||
matches = [] | ||
|
||
matches = word.scan(group) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool use of scan
def self.highest_score_from(array_of_words) | ||
return nil if array_of_words.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this initial "short circuit" of the method to not do any more logic
# # .max on array_of_scores if we want just one, no duplicates | ||
# # Maybe we could do array_of_scores.rindex(array_of_scores.max) which would return the index for the max score which is equal to the index for the corresponding word in array_of_words | ||
|
||
array_of_scores.each_with_index do |score, index| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a great place to use an enumerable method!
player = Scrabble::Player.new("Ari") | ||
# pass word to .play to reach @total_score < 10 | ||
player.play('cat') | ||
player.play('dog').must_equal 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The it
description does't match your assertion here
return picked_tiles | ||
end | ||
|
||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though it is functionally the same - i'd recommend using the else
here to return nil since it is easier to read.
end | ||
end | ||
|
||
@tiles_remaining = 96 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be much better to dynamically grab this # from the collection rather than hard coding it so that if one of the letter counts changed above, you wouldn't need to update this value.
Scrabble
Congratulations! You're submitting your assignment.
Comprehension Questions
score
method in theScoring
class a class method instead of an instance method?Enumerable
mixin? If so, where and why was it helpful?