lib/ttt.rb
def winner_diagonal(board, value, length)
    m_board = Matrix[*board]
    count = 0
    m_board.each_with_index do |e, row, col|
      if row == col
        if e == value
          count += 1
        end
      end
    end
    return true if count == length.to_i
  end
#check on the board if the player won on the main diagonal
check on the board if the player won on the main diagonal
check on the board if the player won on the main diagonal
def winner_diagonal(board, value, length)
    m_board = Matrix[*board]
    count = 0
    m_board.each_with_index do |e, row, col|
      if row == col
        if e == value
          count += 1
        end
      end
    end
    return true if count == length.to_i
  end
def winner_diagonal ( board , value , length ) m_board = Matrix [ * board ] count = 0 m_board . each_with_index do | e , row , col | if row == col if e == value count += 1 end end end return true if count == length . to_i end
check on the board if the player won on the main diagonal
check on the board if the player won on the main diagonal
board
value
length