-
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
&&: Brittany Jones and Monalisa's word guess #12
base: master
Are you sure you want to change the base?
Conversation
Word-Guess GameWhat We're Looking For
|
end | ||
|
||
# Returns word based on theme | ||
def get_theme_word theme |
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 it, a theme!
def update_board letter_guessed | ||
word_split = @word.split("") | ||
# Returns index number of rightly guessed letter | ||
get_word_index = word_split.each_index.select {|index| word_split[index].downcase == letter_guessed} |
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.
Very clever use of Enumerables.
attr_reader :image_type | ||
|
||
def initialize image_type | ||
@image_type = image_type |
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.
Why have this instance variable? What purpose does it serve?
def guessed_letter attempts_left | ||
puts "Please pick a letter (a-z). Your attempts_left are #{attempts_left}" | ||
letter = gets.chomp.downcase | ||
until letter =~ /^[a-zA_Z\s]$/ |
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 defensive programming, good use of a regex!
Word Guess
Congratulations! You're submitting your assignment.
Comprehension Questions