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