Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/gomoku gomoku: remove redundant parentheses around ret...
details: https://anonhg.NetBSD.org/src/rev/9327890a50e8
branches: trunk
changeset: 366143:9327890a50e8
user: rillig <rillig%NetBSD.org@localhost>
date: Sun May 15 22:08:05 2022 +0000
description:
gomoku: remove redundant parentheses around return values
No binary change.
diffstat:
games/gomoku/bdisp.c | 6 +-
games/gomoku/main.c | 6 +-
games/gomoku/makemove.c | 12 +++---
games/gomoku/pickmove.c | 80 ++++++++++++++++++++++++------------------------
games/gomoku/stoc.c | 18 +++++-----
5 files changed, 61 insertions(+), 61 deletions(-)
diffs (truncated from 394 to 300 lines):
diff -r 05fed99ed356 -r 9327890a50e8 games/gomoku/bdisp.c
--- a/games/gomoku/bdisp.c Sun May 15 22:00:11 2022 +0000
+++ b/games/gomoku/bdisp.c Sun May 15 22:08:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bdisp.c,v 1.20 2022/05/15 22:00:11 rillig Exp $ */
+/* $NetBSD: bdisp.c,v 1.21 2022/05/15 22:08:05 rillig Exp $ */
/*
* Copyright (c) 1994
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: bdisp.c,v 1.20 2022/05/15 22:00:11 rillig Exp $");
+__RCSID("$NetBSD: bdisp.c,v 1.21 2022/05/15 22:08:05 rillig Exp $");
#endif
#endif /* not lint */
@@ -317,7 +317,7 @@
}
}
*cp = '\0';
- return (c != EOF);
+ return c != EOF;
}
/*
diff -r 05fed99ed356 -r 9327890a50e8 games/gomoku/main.c
--- a/games/gomoku/main.c Sun May 15 22:00:11 2022 +0000
+++ b/games/gomoku/main.c Sun May 15 22:08:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.29 2022/05/15 22:00:11 rillig Exp $ */
+/* $NetBSD: main.c,v 1.30 2022/05/15 22:08:05 rillig Exp $ */
/*
* Copyright (c) 1994
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: main.c,v 1.29 2022/05/15 22:00:11 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.30 2022/05/15 22:08:05 rillig Exp $");
#endif
#endif /* not lint */
@@ -344,7 +344,7 @@
}
quit();
/* NOTREACHED */
- return (0);
+ return 0;
}
static int
diff -r 05fed99ed356 -r 9327890a50e8 games/gomoku/makemove.c
--- a/games/gomoku/makemove.c Sun May 15 22:00:11 2022 +0000
+++ b/games/gomoku/makemove.c Sun May 15 22:08:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: makemove.c,v 1.12 2022/05/15 22:00:11 rillig Exp $ */
+/* $NetBSD: makemove.c,v 1.13 2022/05/15 22:08:05 rillig Exp $ */
/*
* Copyright (c) 1994
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)makemove.c 8.2 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: makemove.c,v 1.12 2022/05/15 22:00:11 rillig Exp $");
+__RCSID("$NetBSD: makemove.c,v 1.13 2022/05/15 22:08:05 rillig Exp $");
#endif
#endif /* not lint */
@@ -73,18 +73,18 @@
/* check for end of game */
if (mv == RESIGN)
- return (RESIGN);
+ return RESIGN;
/* check for illegal move */
sp = &board[mv];
if (sp->s_occ != EMPTY)
- return (ILLEGAL);
+ return ILLEGAL;
/* make move */
sp->s_occ = us;
movelog[movenum - 1] = mv;
if (++movenum == BSZ * BSZ)
- return (TIE);
+ return TIE;
/* compute new frame values */
sp->s_wval = 0;
@@ -211,7 +211,7 @@
update_overlap(osp);
- return (MOVEOK);
+ return MOVEOK;
}
/*
diff -r 05fed99ed356 -r 9327890a50e8 games/gomoku/pickmove.c
--- a/games/gomoku/pickmove.c Sun May 15 22:00:11 2022 +0000
+++ b/games/gomoku/pickmove.c Sun May 15 22:08:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pickmove.c,v 1.24 2022/05/15 22:00:11 rillig Exp $ */
+/* $NetBSD: pickmove.c,v 1.25 2022/05/15 22:08:05 rillig Exp $ */
/*
* Copyright (c) 1994
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: pickmove.c,v 1.24 2022/05/15 22:00:11 rillig Exp $");
+__RCSID("$NetBSD: pickmove.c,v 1.25 2022/05/15 22:08:05 rillig Exp $");
#endif
#endif /* not lint */
@@ -88,7 +88,7 @@
/* first move is easy */
if (movenum == 1)
- return (PT(K, 10));
+ return PT(K, 10);
/* initialize all the board values */
for (pos = PT(T, 20); pos-- > PT(A, 1); ) {
@@ -173,8 +173,8 @@
*/
if (Tcp->c.a <= 1 && (Ocp->c.a > 1 ||
Tcp->c.a + Tcp->c.b < Ocp->c.a + Ocp->c.b))
- return (sp2 - board);
- return (sp1 - board);
+ return sp2 - board;
+ return sp1 - board;
}
/*
@@ -186,44 +186,44 @@
int them, s, s1;
if (sp->s_combo[us].s < sp1->s_combo[us].s)
- return (1);
+ return 1;
if (sp->s_combo[us].s != sp1->s_combo[us].s)
- return (0);
+ return 0;
if (sp->s_level[us] < sp1->s_level[us])
- return (1);
+ return 1;
if (sp->s_level[us] != sp1->s_level[us])
- return (0);
+ return 0;
if (sp->s_nforce[us] > sp1->s_nforce[us])
- return (1);
+ return 1;
if (sp->s_nforce[us] != sp1->s_nforce[us])
- return (0);
+ return 0;
them = !us;
s = sp - board;
s1 = sp1 - board;
if (BIT_TEST(forcemap, s) && !BIT_TEST(forcemap, s1))
- return (1);
+ return 1;
if (!BIT_TEST(forcemap, s) && BIT_TEST(forcemap, s1))
- return (0);
+ return 0;
if (sp->s_combo[them].s < sp1->s_combo[them].s)
- return (1);
+ return 1;
if (sp->s_combo[them].s != sp1->s_combo[them].s)
- return (0);
+ return 0;
if (sp->s_level[them] < sp1->s_level[them])
- return (1);
+ return 1;
if (sp->s_level[them] != sp1->s_level[them])
- return (0);
+ return 0;
if (sp->s_nforce[them] > sp1->s_nforce[them])
- return (1);
+ return 1;
if (sp->s_nforce[them] != sp1->s_nforce[them])
- return (0);
+ return 0;
if (sp->s_wval > sp1->s_wval)
- return (1);
+ return 1;
if (sp->s_wval != sp1->s_wval)
- return (0);
+ return 0;
- return (random() & 1);
+ return random() & 1;
}
static int curcolor; /* implicit parameter to makecombo() */
@@ -1106,7 +1106,7 @@
for (; (tcbp = cbp->c_link[1]) != NULL;
lcbp = cbp, cbp = cbp->c_link[0]) {
if (tcbp == fcbp)
- return (-1); /* fcbp is already included */
+ return -1; /* fcbp is already included */
/* check for intersection of 'tcbp' with 'fcbp' */
myindex--;
@@ -1120,7 +1120,7 @@
* more than one point.
*/
if (tcbp->c_dir == fcbp->c_dir && (mask & (0x10 << n)))
- return (-1);
+ return -1;
/*
* If this is not the spot we are attaching
* 'fcbp' to and it is a reasonable intersection
@@ -1130,9 +1130,9 @@
if (osp != &board[n]) {
/* check to see if this is a valid loop */
if (verts)
- return (-1);
+ return -1;
if (fcnt == 0 || cbp->c_framecnt[1] == 0)
- return (-1);
+ return -1;
/*
* Check to be sure the intersection is not
* one of the end points if it is an open
@@ -1141,11 +1141,11 @@
if ((flags & C_OPEN_1) &&
(n == tcbp->c_vertex ||
n == tcbp->c_vertex + 5 * dd[tcbp->c_dir]))
- return (-1); /* invalid overlap */
+ return -1; /* invalid overlap */
if (cb.c.b &&
(n == fcbp->c_vertex ||
n == fcbp->c_vertex + 5 * dd[fcbp->c_dir]))
- return (-1); /* invalid overlap */
+ return -1; /* invalid overlap */
vertices->o_intersect = n;
vertices->o_fcombo = cbp;
@@ -1159,7 +1159,7 @@
n = i + ((flags & C_OPEN_0) != 0);
}
if (cbp == fcbp)
- return (-1); /* fcbp is already included */
+ return -1; /* fcbp is already included */
/* check for intersection of 'cbp' with 'fcbp' */
mask = str[cbp - frames];
@@ -1170,7 +1170,7 @@
* more than one point.
*/
if (cbp->c_dir == fcbp->c_dir && (mask & (0x10 << n)))
- return (-1);
+ return -1;
/*
* If this is not the spot we are attaching
* 'fcbp' to and it is a reasonable intersection
@@ -1180,9 +1180,9 @@
if (osp != &board[n]) {
/* check to see if this is a valid loop */
if (verts)
- return (-1);
+ return -1;
if (fcnt == 0 || lcbp->c_framecnt[0] == 0)
- return (-1);
+ return -1;
/*
* Check to be sure the intersection is not
* one of the end points if it is an open
@@ -1191,11 +1191,11 @@
if ((flags & C_OPEN_0) &&
(n == cbp->c_vertex ||
n == cbp->c_vertex + 5 * dd[cbp->c_dir]))
- return (-1); /* invalid overlap */
+ return -1; /* invalid overlap */
if (cb.c.b &&
(n == fcbp->c_vertex ||
n == fcbp->c_vertex + 5 * dd[fcbp->c_dir]))
- return (-1); /* invalid overlap */
+ return -1; /* invalid overlap */
vertices->o_intersect = n;
vertices->o_fcombo = lcbp;
@@ -1206,7 +1206,7 @@
verts++;
}
}
- return (verts);
+ return verts;
}
/*
Home |
Main Index |
Thread Index |
Old Index