-
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 Assignment #23
base: master
Are you sure you want to change the base?
Conversation
ScrabbleWhat We're Looking For
|
letters_array.each do |letter| | ||
if ("a".."z").cover?(letter) | ||
case | ||
when letter == "d" || letter == "g" |
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 structure isn't the most efficient way to do it. Can you see a way to do this more compactly with a hash?
end | ||
|
||
def self.highest_score_from(array_of_words) | ||
array_of_words = array_of_words |
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 line doesn't actually do anything.
highest_score = value | ||
highest_word = word | ||
|
||
elsif (value == highest_score) && (word.length == 7) |
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.
You also need to check that highest_word
isn't 7-letters long. You're missing a case.
end | ||
|
||
it 'if tied, prefer a word with 7 letters' do | ||
#Act |
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.
What about having 2 tied 7-letter words?
end | ||
end | ||
|
||
describe 'plays' do |
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.
You should also try to play words after the player has already won.
|
||
end | ||
|
||
def draw_tiles(number) |
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.
What about when the user tries to draw more tiles than remain in the tile bag.
original_number_of_tiles = grab_bag.tiles_remaining | ||
grab_bag.draw_tiles(6) | ||
|
||
expected_number_of_tiles = original_number_of_tiles - 6 |
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.
good test
end | ||
|
||
end | ||
|
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.
You should also test drawing more tiles than remain in the bag.
|
||
end | ||
|
||
xdescribe 'tiles_remaining' do |
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.
What is this test skipped?
|
||
number_of_tiles = grab_bag.tiles_remaining | ||
|
||
grab_bag.remaining_tiles.length.must_equal number_of_tiles |
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.
better to hard-code the number of tiles.
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?