|
@ -181,3 +181,27 @@ int checkVertical(char board[ROWS][COLS], char player) { |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Write checkDiagonalLR function |
|
|
|
|
|
int checkDiagonalLR(char board[ROWS][COLS], char player) { |
|
|
|
|
|
for (int row = 0; row <= ROWS - 4; row++) { |
|
|
|
|
|
for (int col = 0; col <= COLS - 4; col++) { |
|
|
|
|
|
if (board[row][col] == player && |
|
|
|
|
|
board[row + 1][col + 1] == player && |
|
|
|
|
|
board[row + 2][col + 2] == player && |
|
|
|
|
|
board[row + 3][col + 3] == player) { |
|
|
|
|
|
return 1; // Gewonnen |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|