aboutsummaryrefslogtreecommitdiff
path: root/console/voerbak.c
diff options
context:
space:
mode:
Diffstat (limited to 'console/voerbak.c')
-rw-r--r--console/voerbak.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/console/voerbak.c b/console/voerbak.c
new file mode 100644
index 0000000..4eeabc5
--- /dev/null
+++ b/console/voerbak.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <memory.h>
+
+#define DISC_A "\x1b[31mo\x1b[39m"
+#define DISC_B "\x1b[34mo\x1b[39m"
+#define EMPTY "\x1b[90m_\x1b[39m"
+
+void printBoard(int board[], int width, int height) {
+ for (int y = height - 1; y > -1; y--) {
+ for (int x = 0; x < width; x++) {
+ int val = board[x + y * width];
+ char *print =
+ val == 0 ? EMPTY :
+ val == 1 ? DISC_A :
+ val == 2 ? DISC_B :
+ EMPTY;
+ printf("%s ", print);
+ }
+ printf("\n");
+ }
+}
+
+int main() {
+ int width, height;
+ scanf("%d %d", &width, &height);
+
+ int board[width * height];
+ memset(board, 0, sizeof board);
+
+ board[2] = 1;
+ board[3] = 2;
+ printBoard(board, width, height);
+
+ return 0;
+}