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

Word Guess - Jackie/Phoebe (Ampers) #16

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

Conversation

pmanni02
Copy link

@pmanni02 pmanni02 commented Feb 14, 2018

Word Guess

Congratulations! You're submitting your assignment.

Comprehension Questions

Feature Feedback
How do you feel you and your partner did in sharing responsibilities? We did a good job switching roles of driver and navigator. It was challenging to actually stick to the separate tasks both people are assigned to. It was difficult for me to not focus on the details when being a navigator (Jackie) . I feel like we did a great job in sharing responsibilities and we both explained our code frequently to ensure that we were both understanding it.
For each partner what parts of the project did you find challenging? Phoebe-It was difficult for me to conceptualize how a class within a class gets an instance variable. Jackie - I found it challenging to create appropriate classes for our game. I struggled with visualizing how classes interact with each other if its more than two classes.
Describe an instance where you used a method for something to encapsulate the functionality within your class. What does it do? What are its inputs and outputs? We created a method called split_word within our Words class. The input of the method is another instance variable called @selected_word which is the random word the Game class outputs. The output is an array of all letters within random word. The functionality is that it allows each object of Word to store the array and be used for other methods.
Describe an instance where you used a local variable instead of an instance variable. Why did you make that choice? We used a local variable for the indices array within the match_and_replace method within the Words class. We used a local variable to store the indices in split word that match the users guessed letter. This variable is only needed within the match_and_replace method. The overall class only needs the updated @Dashes array and @correct_guesses array.
What code, if any, did you feel like you were duplicating more than necessary? One place we duplicated code is when we delete a word from our initial array. We could have put the one line of code "simpsons.delete(current_game.selected_word)" outside of the if else statement.
Is there a specific piece of code you'd like feedback on? The display method. Would it have made more sense to move this method inside a class? or maybe make it its own class?

@CheezItMan
Copy link

Word-Guess Game

What We're Looking For

Feature Feedback
Baseline
Regular Commits with meaningful commit messages. Check
Readable code with consistent indentation. Small indentation issues
Answered comprehension questions Check, I think the display method would make sense as a method within a Game class. It wouldn't make sense as it's own object because it's not remembering anything (no instance variables).
Product Functionalities
Created a Class to encapsulate game functionality. Yes, although your classes are mixing roles. Game does things on the word and the word has a lot of Game specific (not word specific) logic to it. The program works, but the organization is messy.
Used methods to DRY up your code. Yes although as you pointed out there are some places to DRY it up a bit.
Created instance variables & local variables where appropriate. Check
Used Arrays to store lists of letters guessed. Check
Used variables & random numbers to allow the game to function with multiple words, no hard-coded answers. Check, used Faker
Programmed "defensively" to detect errors in user input. Check
Summary You hit all the requirements. The only major criticism is that the organization is messy with roles between Game, Word and the main program mixed. It's hard to do right on an early project. Look at how you organized Word Guess as you read POODR chapter 1.

#creates array with 10 random names. partitions first name of each character
simpsons = []
10.times do
name = Faker::Simpsons.character.downcase

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

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

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

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]/

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)

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|

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

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.

2 participants