Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Hangman! #14

wants to merge 5 commits into from

Conversation

nlegg
Copy link

@nlegg nlegg commented Oct 16, 2015

attr_reader :word, :guessed, :tries, :maxtries

def initialize
@word = File.readlines('words.txt').sample.strip.upcase
Copy link
Member

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.

Copy link
Author

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants