lib/ttt.rb
def winner_diagonal_inverse(board, value, length)
    m_board = Matrix[*board]
    count = 0
    m_board.square? && (0...m_board.row_size).each do |i|
      if m_board[i, m_board.row_size - 1 - i] == value
        count += 1
        if count == length.to_i
          return true
          break
        end
      end
    end
  end
#check on the board if the player won the reverse diagonal
check on the board if the player won the reverse diagonal
check on the board if the player won the reverse diagonal
def winner_diagonal_inverse(board, value, length)
    m_board = Matrix[*board]
    count = 0
    m_board.square? && (0...m_board.row_size).each do |i|
      if m_board[i, m_board.row_size - 1 - i] == value
        count += 1
        if count == length.to_i
          return true
          break
        end
      end
    end
  end
def winner_diagonal_inverse ( board , value , length ) m_board = Matrix [ * board ] count = 0 m_board . square? && ( 0 ... m_board . row_size ) . each do | i | if m_board [ i , m_board . row_size - 1 - i ] == value count += 1 if count == length . to_i return true break end end end end
check on the board if the player won the reverse diagonal
check on the board if the player won the reverse diagonal
board
value
length