It's time to work on winning according to the rules of the game. This is the part where, when compared with the previous code, work becomes a bit more tedious. We should check all the possible winning combinations and, if one of them is fulfilled, declare a winner.
A player wins by being the first to connect a line of friendly pieces from one side or corner of the board to the other.
To check whether a line of friendly pieces is connected, we should verify horizontal, vertical, and diagonal lines.