-
Notifications
You must be signed in to change notification settings - Fork 27
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
Word-Guess - Kiera & Hannah - Octos #23
base: master
Are you sure you want to change the base?
Conversation
Word-Guess GameWhat We're Looking For
This is an interesting submission. Your class-less version of the program certainly works, but I'm not sure it addresses the learning goals. For working on the classy version, one thing that I often find helpful is thinking about how my class will be used. For this project, that might mean starting by writing some (rough) driver code, something like: game = Game.new
while !game.is_over?
game.print_state
puts "Letter please"
letter = gets.chomp
game.guess_letter(letter)
end Let me know if you'd like some more guidance or feedback on this. Make sure to spend some time focusing on classes for the Grocery Store project, and keep up the hard work! |
when 0 | ||
print picture_5 | ||
when 1 | ||
print picture_4 |
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.
Instead of this big case
statement, could you put the different images into an array?
check_guess(split_word, guess, word_template) | ||
if word_template.include?("_") == false | ||
puts "Congratulations - you win!!" | ||
exit |
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.
On line 197, .include?
will already return a boolean value, so you don't need a separate comparison to false. Either of
if !word_template.include?("_")
# or
unless word_template.include?("_")
would suffice.
def initalize | ||
@random_word = get_random_word | ||
@word_template = word_template | ||
@split_word = split_word |
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 seems like it's on the right track. In addition to the word to guess and the array of letters and underscores, you'll need to keep track of what letters have been guessed so far, and how many lives the player has left.
I do like that you've split some of the initialization work out into separate methods.
Word Guess
Congratulations! You're submitting your assignment.
Comprehension Questions