-
Notifications
You must be signed in to change notification settings - Fork 25
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
Pipes - Kate Evans-Spitzer & Angela Wilson - Word-Guess #3
base: master
Are you sure you want to change the base?
Conversation
Word-Guess GameWhat We're Looking For
Great work overall. Code is well-organized and easy to read. I've got a few specific comments below, but in general I'm quite happy with this submission. |
user_has_won = !(game_board.blank.include?"_") | ||
user_has_lost = game_board.tries_remaining == 0 | ||
|
||
until (user_has_won || user_has_lost) |
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.
Since you make these calculations for user_has_won
and user_has_lost
multiple times, they might be a good candidate for an instance method on Board
.
puts "Please guess a letter: " | ||
guess = gets.chomp.upcase | ||
if game_board.letters_guessed.include?guess | ||
puts "You've already guessed that!" |
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 logic all looks good, but the code might be a little cleaner if it were all wrapped up into its own method. Maybe call it something like take_turn
.
def initialize_word_bank | ||
return ["ear", | ||
"heart", | ||
"irritate", |
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 love that you've separated your words out into a separate file. This makes it very clear which part of the program is which, and the reader doesn't have to scroll through a hundred lines of words at the top of your file.
def display | ||
output = "" | ||
output += @tries_pictures[@tries_remaining-1] + "\n" | ||
output += @blank + "\n" |
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 that you've rolled all this up into an instance method. Very concise.
Word Guess
Congratulations! You're submitting your assignment.
Comprehension Questions