The #position_taken? method will be responsible for evaluating the user's input against the Tic Tac Toe board and checking to see whether or not that position is occupied. If the user inputs that they would like to fill out position 2, our #position_taken? method will check to see if that position is vacant or if it contains an "X" or and "O". If the position is free, the method should return false (i.e. "not taken"), otherwise it will return true. This method will also deal with 'user friendly' data (a String with a 1-9 number)
but 01_tic_tac_toe_spec.rb tests:
position = 0
expect(game.position_taken?(position)).to be(true)
position given is not "user-friendly," it is a 0-based index.
README says:
#position_taken?
The
#position_taken?
method will be responsible for evaluating the user's input against the Tic Tac Toe board and checking to see whether or not that position is occupied. If the user inputs that they would like to fill out position2
, our#position_taken?
method will check to see if that position is vacant or if it contains an "X" or and "O". If the position is free, the method should returnfalse
(i.e. "not taken"), otherwise it will returntrue
. This method will also deal with 'user friendly' data (a String with a 1-9 number)but 01_tic_tac_toe_spec.rb tests:
position given is not "user-friendly," it is a 0-based index.