diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -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; +} |