Building tic tac toe game through scratch stuck while checking winning

Solution 1:

The main reason why you're not getting the winner is because your 'values = @board.values_at(*indices)' statement returns an array of arrays. And values.all?('X') || values.all?('O') checks not an 'X' or 'O' pattern but an array object. So you need to flatten an array first.

values.flatten!

Stefan already answered similar question , but his board was one-dimensional because of %w expression, you can read about it here