TP_13 exo2: Finish the implementation of a basic tic-tac-toe game.
[TD_C.git] / TP_13 / exo2 / lib / display.c
index 1e5def8f66dc154056b67e1e4defcc6661ee732a..21d85bb84cbece58dff339b217de62212d6cfb3a 100644 (file)
@@ -24,6 +24,7 @@
  * which can be a space ' ' */
 
 void print_board(int y, int x) {
+
     mvprintw(y, x, "    |    |");
     mvprintw(y+1, x, "    |    |");
     mvprintw(y+2, x, "----+----+----");
@@ -47,12 +48,14 @@ void print_board(int y, int x) {
  * The added (y, x) couple values can be {0, 3, 6}x{1, 6, 11}
  */
 
-void print_x(int y, int x) {
+static void print_x(int y, int x) {
+
     mvprintw(y, x, "\\/");
     mvprintw(y+1, x,"/\\");
 }
 
-void print_o(int y, int x) {
+static void print_o(int y, int x) {
+
     mvprintw(y, x, "/\\");
     mvprintw(y+1, x, "\\/");
 }
@@ -61,6 +64,7 @@ void print_o(int y, int x) {
  *    2 -> +3     2 -> +6
  *    3 -> +6     3 -> +11 */
 static int remap_y(int y) {
+
     if (y == 1) {
         return 0;
     } else if (y == 2) {
@@ -71,6 +75,7 @@ static int remap_y(int y) {
 }
 
 static int remap_x(int x) {
+
     if (x == 1) {
         return 1;
     } else if (x == 2) {
@@ -82,6 +87,7 @@ static int remap_x(int x) {
 
 void print_coordinates(coordinates_t coordinates_array[], int base_y, int base_x) {
     unsigned i = 0;
+
     while ((coordinates_array + i)->y != 0 && (coordinates_array + i)->x != 0) {
         if ((coordinates_array + i)->type == 0) {
             print_o(base_y + remap_y((coordinates_array + i)->y), base_x + remap_x((coordinates_array + i)->x));
@@ -91,3 +97,19 @@ void print_coordinates(coordinates_t coordinates_array[], int base_y, int base_x
         i++;
     }
 }
+
+/* void printf_result(unsigned player, unsigned round) {
+    char* result_msg = "";
+
+    if (round < MAX_COORDINATES + 1) {
+        if (player == 0) {
+            result_msg = "Joueur 1";
+        } else {
+            result_msg = "Joueur 2";
+        }
+        printf("%s gagne !\n", result_msg);
+    } else {
+        printf("Egalite !\n");
+    }
+} */
+