Tic Tac Toe - need help displaying board (Human Player Class)

Hi, I can’t seem to figure out how to display the board for the human player class. I even pasted in the answer for the display method and I still got an error, which is the following:
HumanPlayer #display prints the board to the screen Failure/Error: human.display(board) NoMethodError: undefined method []' for #<Board:0x007ffb099759f8> # ./lib/human_player.rb:24:inblock in display’
# ./lib/human_player.rb:23:in each' # ./lib/human_player.rb:23:indisplay’
# ./spec/human_player_spec.rb:62:in block (3 levels) in <top (required)>

I’m not sure what to do, and I don’t know if my code from the previous board class is causing the problem. Any help would be appreciated. I can post the code that I wrote for the board class if that would help as well.

Hey David,

I think we talked about this in the discussion tab, but I just wanted to double check that you were able to move forward. I think the issue had to do with understanding the attr_accessor and writing your own [] methods. Let me know! :nerd_face:

Hi! I have the same question as this post, but it was never fully answered. Can you explain what the [] method is? I tried looking it up online and nothing showed up

Hi mafeg95,

Here’s the link to the [] method reading:
The reading does a good job explaining how to use the method and why we want to use it.


Thanks for your reply, but the link doesn’t work. Fortunately, I was able to find the information here: https://s3-us-west-1.amazonaws.com/aa-online/bracket-methods.pdf

Oh okay. Thanks for letting me know that link is busted. I will use your link as reference for future purposes. They are the same readings in the end.

1 Like