lib/ttt.rb
#Check on the board if the player won in any of the rows
Check on the board if the player won in any of the rows
Check on the board if the player won in any of the rows
def winner_row(board, value, length)
    m_board = Matrix[*board]
    i = 0
    while i < length.to_i
      winner = m_board.row(i).all? {|v| v == value}
      if winner
        return true
        break
      end
      i += 1
    end
  end
def winner_row ( board , value , length ) m_board = Matrix [ * board ] i = 0 while i < length . to_i winner = m_board . row ( i ) . all? { | v | v == value } if winner return true break end i += 1 end end
Check on the board if the player won in any of the rows
Check on the board if the player won in any of the rows
board
value
length