Be more explicit in Makefiles about external libraries linking
[TD_C.git] / TP_13 / exo2 / lib / display.c
index 21d85bb84cbece58dff339b217de62212d6cfb3a..72bd0f5f37e071b639d7da69ac025f0d21956eb4 100644 (file)
@@ -23,6 +23,7 @@
 /* in all print routine, y and x are the coordinates of the first character of the shape
  * which can be a space ' ' */
 
+/* FIXME: one can split this shape in building blocks and build it using them */
 void print_board(int y, int x) {
 
     mvprintw(y, x, "    |    |");
@@ -67,9 +68,11 @@ static int remap_y(int y) {
 
     if (y == 1) {
         return 0;
-    } else if (y == 2) {
-        return 3;
-    } else {
+    } else if (y > 1 && y <= 3) {
+        return (remap_y(y - 1) + 3);
+    }  else {
+        /* FIXME: return an error value like -1
+         * but for now there a bug somewhere */
         return 6;
     }
 }
@@ -78,9 +81,11 @@ static int remap_x(int x) {
 
     if (x == 1) {
         return 1;
-    } else if (x == 2) {
-        return 6;
+    } else if (x > 1 && x <= 3) {
+        return (remap_x(x - 1) + 5);
     } else {
+        /* FIXME: return an error value like -1
+         * but for now there a bug somewhere */
         return 11;
     }
 }
@@ -97,19 +102,3 @@ 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");
-    }
-} */
-