Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/gomoku gomoku: right-align column header for move number



details:   https://anonhg.NetBSD.org/src/rev/04911ae9e28f
branches:  trunk
changeset: 366282:04911ae9e28f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat May 21 17:19:10 2022 +0000

description:
gomoku: right-align column header for move number

diffstat:

 games/gomoku/bdisp.c  |  12 ++++++------
 games/gomoku/gomoku.h |   4 ++--
 games/gomoku/main.c   |   9 ++++-----
 games/gomoku/stoc.c   |   6 +++---
 4 files changed, 15 insertions(+), 16 deletions(-)

diffs (117 lines):

diff -r c89d92b8277b -r 04911ae9e28f games/gomoku/bdisp.c
--- a/games/gomoku/bdisp.c      Sat May 21 16:39:14 2022 +0000
+++ b/games/gomoku/bdisp.c      Sat May 21 17:19:10 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bdisp.c,v 1.41 2022/05/21 15:21:40 rillig Exp $        */
+/*     $NetBSD: bdisp.c,v 1.42 2022/05/21 17:19:10 rillig Exp $        */
 
 /*
  * Copyright (c) 1994
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 /*     @(#)bdisp.c     8.2 (Berkeley) 5/3/95   */
-__RCSID("$NetBSD: bdisp.c,v 1.41 2022/05/21 15:21:40 rillig Exp $");
+__RCSID("$NetBSD: bdisp.c,v 1.42 2022/05/21 17:19:10 rillig Exp $");
 
 #include <curses.h>
 #include <string.h>
@@ -46,7 +46,7 @@
 #define        SCRNW           80              /* assume 80 chars for the moment */
 
 static int     lastline;
-static char    pcolor[] = "*O.?";
+static const char pcolor[] = "*O.?";
 
 #define        scr_y(by)       (1 + (BSZ - 1) - ((by) - 1))
 #define        scr_x(bx)       (3 + 2 * ((bx) - 1))
@@ -107,12 +107,12 @@
 
        /* left and right edges */
        for (int j = BSZ + 1; --j > 0; ) {
-               mvprintw(scr_y(j), 0, "%2d ", j);
-               mvprintw(scr_y(j), scr_x(BSZ) + 2, "%d ", j);
+               mvprintw(scr_y(j), 0, "%2d", j);
+               mvprintw(scr_y(j), scr_x(BSZ) + 2, "%d", j);
        }
 
        bdwho();
-       mvaddstr(0, TRANSCRIPT_COL + 1, "#  black  white");
+       mvaddstr(0, TRANSCRIPT_COL, "  #  black  white");
        lastline = 0;
        bdisp();
 }
diff -r c89d92b8277b -r 04911ae9e28f games/gomoku/gomoku.h
--- a/games/gomoku/gomoku.h     Sat May 21 16:39:14 2022 +0000
+++ b/games/gomoku/gomoku.h     Sat May 21 17:19:10 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gomoku.h,v 1.37 2022/05/21 16:39:14 rillig Exp $       */
+/*     $NetBSD: gomoku.h,v 1.38 2022/05/21 17:19:10 rillig Exp $       */
 
 /*
  * Copyright (c) 1994
@@ -215,7 +215,7 @@
 #define BFLAG          0x010000        /* frame intersects border or dead */
 #define BFLAGALL       0x0F0000        /* all frames dead */
 
-extern const char      *letters;
+extern const char      letters[];
 extern const char      pdir[];
 
 extern const int     dd[4];
diff -r c89d92b8277b -r 04911ae9e28f games/gomoku/main.c
--- a/games/gomoku/main.c       Sat May 21 16:39:14 2022 +0000
+++ b/games/gomoku/main.c       Sat May 21 17:19:10 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.47 2022/05/21 14:55:26 rillig Exp $ */
+/*     $NetBSD: main.c,v 1.48 2022/05/21 17:19:10 rillig Exp $ */
 
 /*
  * Copyright (c) 1994
@@ -36,7 +36,7 @@
 __COPYRIGHT("@(#) Copyright (c) 1994\
  The Regents of the University of California.  All rights reserved.");
 /*     @(#)main.c      8.4 (Berkeley) 5/4/95   */
-__RCSID("$NetBSD: main.c,v 1.47 2022/05/21 14:55:26 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.48 2022/05/21 17:19:10 rillig Exp $");
 
 #include <sys/stat.h>
 #include <curses.h>
@@ -306,9 +306,8 @@
                        break;
                }
                if (interactive) {
-                       misclog("%3d%s%-6s", movenum,
-                           color != BLACK ? "        " : " ",
-                           stoc(curmove));
+                       misclog("%3d%*s%-6s", movenum,
+                           color == BLACK ? 2 : 9, "", stoc(curmove));
                }
                if ((i = makemove(color, curmove)) != MOVEOK)
                        break;
diff -r c89d92b8277b -r 04911ae9e28f games/gomoku/stoc.c
--- a/games/gomoku/stoc.c       Sat May 21 16:39:14 2022 +0000
+++ b/games/gomoku/stoc.c       Sat May 21 17:19:10 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stoc.c,v 1.18 2022/05/19 22:19:18 rillig Exp $ */
+/*     $NetBSD: stoc.c,v 1.19 2022/05/21 17:19:10 rillig Exp $ */
 
 /*
  * Copyright (c) 1994
@@ -34,14 +34,14 @@
 
 #include <sys/cdefs.h>
 /*     @(#)stoc.c      8.1 (Berkeley) 7/24/94  */
-__RCSID("$NetBSD: stoc.c,v 1.18 2022/05/19 22:19:18 rillig Exp $");
+__RCSID("$NetBSD: stoc.c,v 1.19 2022/05/21 17:19:10 rillig Exp $");
 
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
 #include "gomoku.h"
 
-const char     *letters        = "<ABCDEFGHJKLMNOPQRST>";
+const char     letters[]       = "<ABCDEFGHJKLMNOPQRST>";
 
 struct mvstr {
        int     m_code;



Home | Main Index | Thread Index | Old Index