summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorsumuel <samuel@yakubos.org>2026-07-15 06:46:24 +0100
committersumuel <samuel@yakubos.org>2026-07-15 06:46:24 +0100
commitf29f867a18ee82d6c79900420b6a6d5f66a75f18 (patch)
tree900a0cf9f59f2485e1eb0c190f7c16ef5082babb /main.c
init
Diffstat (limited to 'main.c')
-rw-r--r--main.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..18327a3
--- /dev/null
+++ b/main.c
@@ -0,0 +1,46 @@
+#include <ncurses.h>
+#include <stdlib.h>
+#include "board.h"
+#include "input.h"
+
+int main() {
+ int ch;
+
+ initscr(); /* Start curses mode */
+ if(has_colors() == FALSE)
+ { endwin();
+ printf("Your terminal does not support colour\n");
+ exit(1);
+ }
+ start_color(); /* Start color */
+ noecho();
+ curs_set(0);
+ keypad(stdscr, TRUE);
+ /* End of ncurses init nonsense */
+
+ /* Don't use black it will mess with the background colour */
+ init_color(COLOR_RED, 556, 388, 176);
+ init_color(COLOR_WHITE, 820, 840, 880);
+ init_pair(1, COLOR_RED, COLOR_WHITE);
+ init_pair(2, COLOR_WHITE, COLOR_RED);
+ init_pair(3, COLOR_YELLOW, COLOR_MAGENTA);
+ init_pair(4, COLOR_CYAN, COLOR_BLACK);
+
+ while (turns < 1000){
+ refresh(); /* Print it on to the real screen */
+ char *player;
+ player = (turns & 1) ? "BLACK" : "WHITE";
+
+ printw("Here is the board:\n");
+ PrintBoard(board); /* Print out the chess board */
+ printw("Turn No. %d (%s)", turns, player);
+
+ ch = getch(); /* Wait for user input */
+ InputBoard(board, ch);
+ clear();
+
+ }
+
+ endwin(); /* End curses mode */
+ return 0;
+}