Look to the left and right of the last move and count the matching positions.
This correctly identifies a win on a horizontal line.