fcd3bcc04279d7d61d6f5b838e00794d10f6f7ad
[TD_C.git] / TP_13 / exo2 / src / main.c
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <ncurses.h>
4
5 #include "display.h"
6
7 int main() {
8 int row, col;
9
10 initscr();
11 getmaxyx(stdscr,row,col);
12 noecho();
13 curs_set(0);
14
15 /* center base coordinates for the board */
16 const int base_y = row/2 - 4;
17 const int base_x = col/2 - 7;
18
19 print_board(base_y, base_x);
20
21 print_x(base_y, base_x + 1);
22 print_o(base_y, base_x + 6);
23 print_o(base_y, base_x + 11);
24 print_o(base_y + 3, base_x + 1);
25 print_o(base_y + 6, base_x + 1);
26 print_o(base_y + 3, base_x + 6);
27 print_x(base_y + 3, base_x + 11);
28 print_x(base_y + 6, base_x + 6);
29 print_x(base_y + 6, base_x + 11);
30
31 refresh();
32
33 while (getch() != 'q');
34
35 endwin();
36
37 exit(EXIT_SUCCESS);
38 }