add messages
authorLaurent Mazet <mazet@softndesign.org>
Thu, 19 Sep 2024 21:07:49 +0000 (23:07 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Thu, 19 Sep 2024 21:21:33 +0000 (23:21 +0200)
reversi.c

index 5eb26a76cbb823df5324e8847d218b9cae81d022..a6222b8122067df2678b00136171f1b6d4929c60 100644 (file)
--- a/reversi.c
+++ b/reversi.c
@@ -167,7 +167,7 @@ int main (int argc, char *argv[])
 
     /* window positions */
     int xmsg = xboard;
-    int ymsg = max (yboard + xoffset + 1 + board->ysize, yhelp + lhelp + yoffset + 1);
+    int ymsg = max (yboard + xoffset + 1 + board->ysize, yhelp + lhelp + yoffset);
     int lmsg = xhelp - xmsg + strmaxlen (help, '\n');
 
     /* main loop */
@@ -176,12 +176,17 @@ int main (int argc, char *argv[])
     int id = 0;
     int mode = 0;
     while (!stop) {
+        char msg[128] = {0};
+        msgwindow (msg, xmsg, ymsg, lmsg);
 
         /* board */
         board_t *boardturn = copyboard (board);
+        sprintf (msg, "Player %s", id ? "Two" : "One");
         if (!find (boardturn, id)) {
+            sprintf (msg, "Skip %s", id ? "Two" : "One");
             id = id ? 0 : 1;
             if (!find (boardturn, id)) {
+                sprintf (msg, "End of game");
                 mode = 1;
             }
         }
@@ -194,7 +199,7 @@ int main (int argc, char *argv[])
         }
 
         /* message */
-
+        msgwindow (msg, xmsg, ymsg, lmsg);
 
         /* get key press */
         int ch = getch ();