[Hangman] HumanPlayer#handle_response

I had a quick question about the significance of the method handle_response in the HumanPlayer class in the Hangman game that we are supposed to recreate. So each “turn” that is taken in the game goes through the following process:

  • guesser guesses a character
  • referee checks if the guess is in the secret word
  • the board/visuals update
  • guesser “handles response”

When the guesser is a computer, ComputerPlayer#handle_response has a logical place in the turn sequence because the computer has to further shrink its array of “possible words” that the secret word could be given the feedback of whether or not the guess was accepted or rejected. However, my HumanPlayer#handle_response is currently completely blank (and the game runs fine as far as I have tested it). It takes in the same arguments as ComputerPlayer#handle_response in order to avoid an ArgumentError, but does nothing.

I just thought I’d ask to see if anyone could give me insight into this. Is there something I’m missing/could be doing more logically, or is this just a common scenario when there are different classes that could take the same place in a program?

Hey, I don’t believe that the human player’s handle response needs to be anything substantial. For mine I just did this:
def handle_response(letter, indices)
if indices.empty?
puts “Your letter was not found on the board”

else
  puts "The letter #{letter} was found at the following indices #{indices.to_s}"
end

end

Letting the person know that their guess was actually inputed and understood.

Okay, that makes sense. I think I have a similar message elsewhere in the program, so I’ve just left HumanPlayer#handle_response empty for now :slight_smile: