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