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

Samantha Berk & Winifred Irarrazaval - Word-Guess - Octos #15

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

Conversation

samanthaberk
Copy link

@samanthaberk samanthaberk 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 took turns typing and jointly discussed the assignment and possible code we could write to meet the assignments
For each partner what parts of the project did you find challenging? It was challenging to force ourselves to talk about the code. Rather than experimenting to see what would work, we had to think aloud about what we thought the possible results of a line of code might do, which made us more thoughtful and and cautious about our work and helped us better understand the code because the focus was not so much in getting the program to work as it was explaining why something would work
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? On our "Game" class, we used a method to compare what the user input (i.e. their letter guess) to the hidden word. This method "compare" takes in the user input, which is an instance variable, as an argument. The method iterates through the array of the hidden word (with each letter as a separate element) and, if the user's guess is equal to one of those elements, it finds the index of that element and replaces replaces the blank line in the corresponding array displaying the blank spaces/correct letters at the same index. If the guess is not equal to any of those elements, the guess is shoveled into the array representing false guesses.
Describe an instance where you used a local variable instead of an instance variable. Why did you make that choice? In line 144 and 153, we used a local variable guess to get the user's input. We did this so we could pass it in as an argument for our instance method to compare the guess to the array of letters representing the secret word.
What code, if any, did you feel like you were duplicating more than necessary? We duplicated a lot of code for removing the parachute strings in the picture.
Is there a specific piece of code you'd like feedback on? We struggled with linking the Game and Picture classes, specifically since both classes needed to keep track of how many lives a player had left and output something to the user (displaying lives left and removing the parachute strings, respectively. We are wondering if there is another way to do this.

@droberts-sea
Copy link

Word-Guess Game

What We're Looking For

Feature Feedback
Baseline
Regular Commits with meaningful commit messages. yes - good work
Readable code with consistent indentation. yes
Answered comprehension questions yes
Product Functionalities
Created a Class to encapsulate game functionality. yes
Used methods to DRY up your code. yes
Created instance variables & local variables where appropriate. yes
Used Arrays to store lists of letters guessed. yes
Used variables & random numbers to allow the game to function with multiple words, no hard-coded answers. yes
Programmed "defensively" to detect errors in user input. no - I was able to enter "foo", "" and "#$^%" without problems

Great job overall! I especially appreciate the organization of having all the art logic live in a separate class - this makes your Game class much easier to read. I've left a few nitpicks below, but overall I am very pleased with this submission. Keep up the hard work!

@@ -0,0 +1,171 @@
require 'colorize'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be named word_guess.rb. Without the suffix, GitHub doesn't know to syntax highlight it!

print_strings
end
def remove2
@parachute_strings[-1] = " "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right that this code is duplicated, but it's also a tricky thing to figure out how to print only what you want. What if you modified the print_strings method to take a number of lives remaining - something like this:

def print_strings(lives_left)
  # strings before the center strap
  (0...2).each do |i|
    if i <= lives_left
      print @parachute_strings[i].colorize(:magenta)
    else
      print " " * @parachute_strings[i].length
    end
  end

  # center strap
  print @parachute_strings[2]

  # strings after the strap
  (3...5).each do |i|
    if i <= lives_left
      print @parachute_strings[i].colorize(:magenta)
    else
      print " " * @parachute_strings[i].length
    end
  end
end

The center strap makes the whole thing much more complex - maybe it would be best to just take it out.

case @life
when 4
@picture.remove1
when 3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we made the above change, here we would replace this entire case statement with:

@picture.print_strings(@life)


parachute_man = Picture.new()
new_game = Game.new(word_list.sample.split(""), parachute_man, parachute_man.life )
puts

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the initial life count comes from the picture, it's a little redundant to pass both into the constructor here.

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