So guys, say you have a tic-tac-toe game which already works. When is the winner declared? When you find three matching characters in a row, horizontally, vertically or diagonally. In the basic game, this would be on a 3x3 grid, most likely grid.
1 2 3
- - X
O X O
X - -
But how do I check the condition without brute-forcing if statements? Sure it could be easy to work out some solution where you check if an entire row is 'X' or 'O' with a loop or something, but even that's awkward for diagonals.
My actual problem, though, is much harder to deal with than tic-tac-toe results. What if my grid is  and I want something to happen if there's a T shape somewhere? Or if there's a Tetris S shape? You can't brute force that, there are thousands of possibilities. To help illustrate: