-
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 - Jackie/Phoebe (Ampers) #16
base: master
Are you sure you want to change the base?
Conversation
…od, and match_and_replace method
Word-Guess GameWhat We're Looking For
|
#creates array with 10 random names. partitions first name of each character | ||
simpsons = [] | ||
10.times do | ||
name = Faker::Simpsons.character.downcase |
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 the theme!
simpsons << name | ||
end | ||
|
||
class Game |
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 Game
class doesn't seem to have much Game
logic in it. Most of the game logic rests in Word
, maybe looking at what roles each class is performing would be worthwhile.
end | ||
|
||
# Gives us array of dashes based on number of letters in random_word | ||
def get_init_dashes |
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 does the game generate the list of dashes, wouldn't the word be able to do that?
end | ||
|
||
|
||
def remove_life |
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.
Removing lives seems like a game action.
|
||
#checks for alpha input | ||
def valid_letter(input_guess) | ||
if input_guess =~ /[a-zA-Z]/ |
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 use of regex, but why would the word check for a valid guess...
end | ||
|
||
#for correct_guesses letter is input into dash array | ||
def match_and_replace(guess) |
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 method has some small indentation issues.
puts "Homer gave you five donuts (tries). Every time you guess incorrectly, he eats one of your donuts!" | ||
|
||
#shows initial donuts and displays dash array | ||
our_game.initial_tries.each do |donut| |
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 is also a lot of Game
logic that should go with Game
Word Guess
Congratulations! You're submitting your assignment.
Comprehension Questions