aboutsummaryrefslogtreecommitdiff
path: root/api/game/voerbak.c
diff options
context:
space:
mode:
Diffstat (limited to 'api/game/voerbak.c')
-rw-r--r--api/game/voerbak.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/api/game/voerbak.c b/api/game/voerbak.c
index f0ecb4a..5674f5e 100644
--- a/api/game/voerbak.c
+++ b/api/game/voerbak.c
@@ -60,6 +60,12 @@ bool checkWin(int board[], int width, int height, int pos) {
return won;
}
+bool boardFull(int board[], int width, int height) {
+ for (int i = 0; i < width * height; i++)
+ if (board[i] == 0) return false;
+ return true;
+}
+
bool dropFisje(int board[], int width, int height, int column, int disc) {
for (int row = 0; row < height; row++) {
int pos = column + row * width;
@@ -93,6 +99,11 @@ int main() {
printf("m:%s\n", player_1 ? "true" : "false");
fflush(stdout);
+ if (boardFull(board, width, height)) {
+ printf("d:full\n");
+ fflush(stdout);
+ }
+
printBoard(board, width, height);
}