|
|
@ -202,6 +202,21 @@ int checkDiagonalLR(char board[ROWS][COLS], char player) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Write checkDiagonalRL function |
|
|
|
int checkDiagonalRL(char board[ROWS][COLS], char player) { |
|
|
|
for (int row = 0; row <= ROWS - 4; row++) { |
|
|
|
for (int col = 3; col < COLS; 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; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|