-
Notifications
You must be signed in to change notification settings - Fork 31
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
Hangman! #14
base: master
Are you sure you want to change the base?
Hangman! #14
Conversation
attr_reader :word, :guessed, :tries, :maxtries | ||
|
||
def initialize | ||
@word = File.readlines('words.txt').sample.strip.upcase |
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 only ever use @word.chars
. Might as well append a .chars
and rename this @word_chars
.
The Law of Demeter is more of a suggestion.
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.
word
is referred to by the controller for the finish
method. Should I handle that some other way?
|
||
# start a new game | ||
def reset | ||
initialize |
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 don't think I've ever done this before. I like the use case.
@jaybobo @mikegee