|
@ -138,3 +138,15 @@ void clearScreen() { |
|
|
int isColumnFull(char board[ROWS][COLS], int col) { |
|
|
int isColumnFull(char board[ROWS][COLS], int col) { |
|
|
return (board[0][col] != ' '); |
|
|
return (board[0][col] != ' '); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Write dropPiece function |
|
|
|
|
|
int dropPiece(char board[ROWS][COLS], int col, char player) { |
|
|
|
|
|
for (int i = ROWS - 1; i >= 0; i--) { |
|
|
|
|
|
if (board[i][col] == ' ') { |
|
|
|
|
|
board[i][col] = player; |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; // Column is full |
|
|
|
|
|
} |