summaryrefslogtreecommitdiff
path: root/games/gomoku
diff options
context:
space:
mode:
authormestre <mestre@cvs.openbsd.org>2016-01-08 21:38:34 +0000
committermestre <mestre@cvs.openbsd.org>2016-01-08 21:38:34 +0000
commitfe7f2e9e7412d1c4b442a922219479ddf710e09a (patch)
treee9c5b1a084ede704a825e294889b8f36bf6a3ad9 /games/gomoku
parentd06c42a213e5c3a19f7e6f668095fb0653b7d2db (diff)
ANSIfy gomoku(6) and change a char* to u_char*
OK tb@
Diffstat (limited to 'games/gomoku')
-rw-r--r--games/gomoku/bdinit.c7
-rw-r--r--games/gomoku/bdisp.c26
-rw-r--r--games/gomoku/main.c29
-rw-r--r--games/gomoku/makemove.c10
-rw-r--r--games/gomoku/pickmove.c69
-rw-r--r--games/gomoku/stoc.c11
6 files changed, 48 insertions, 104 deletions
diff --git a/games/gomoku/bdinit.c b/games/gomoku/bdinit.c
index 76ceb584b8e..0b58176dfa8 100644
--- a/games/gomoku/bdinit.c
+++ b/games/gomoku/bdinit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bdinit.c,v 1.7 2016/01/04 17:33:24 mestre Exp $ */
+/* $OpenBSD: bdinit.c,v 1.8 2016/01/08 21:38:33 mestre Exp $ */
/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
@@ -36,8 +36,7 @@
#include "gomoku.h"
void
-bdinit(bp)
- struct spotstr *bp;
+bdinit(struct spotstr *bp)
{
int i, j, r;
struct spotstr *sp;
@@ -163,7 +162,7 @@ bdinit(bp)
* common open spaces shared between the two frames.
*/
void
-init_overlap()
+init_overlap(void)
{
struct spotstr *sp1, *sp2;
struct combostr *cbp;
diff --git a/games/gomoku/bdisp.c b/games/gomoku/bdisp.c
index e649f658162..d583ff840db 100644
--- a/games/gomoku/bdisp.c
+++ b/games/gomoku/bdisp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bdisp.c,v 1.12 2016/01/04 17:33:24 mestre Exp $ */
+/* $OpenBSD: bdisp.c,v 1.13 2016/01/08 21:38:33 mestre Exp $ */
/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
@@ -47,7 +47,7 @@ static char pcolor[] = "*O.?";
* Initialize screen display.
*/
void
-cursinit()
+cursinit(void)
{
initscr();
if ((LINES < SCRNH) || (COLS < SCRNW)) {
@@ -70,7 +70,7 @@ cursinit()
* Restore screen display.
*/
void
-cursfini()
+cursfini(void)
{
move(BSZ4, 0);
clrtoeol();
@@ -83,7 +83,7 @@ cursfini()
* Initialize board display.
*/
void
-bdisp_init()
+bdisp_init(void)
{
int i, j;
@@ -115,8 +115,7 @@ bdisp_init()
* Update who is playing whom.
*/
void
-bdwho(update)
- int update;
+bdwho(int update)
{
int i, j;
extern char *plyr[];
@@ -148,7 +147,7 @@ bdwho(update)
* Update the board display after a move.
*/
void
-bdisp()
+bdisp(void)
{
int i, j, c;
struct spotstr *sp;
@@ -176,8 +175,7 @@ bdisp()
/*
* Dump board display to a file.
*/
-void bdump(fp)
- FILE *fp;
+void bdump(FILE *fp)
{
int i, j, c;
struct spotstr *sp;
@@ -215,8 +213,7 @@ void bdump(fp)
* Display a transcript entry
*/
void
-dislog(str)
- char *str;
+dislog(char *str)
{
if (++lastline >= SCRNH - 1) {
@@ -236,8 +233,7 @@ dislog(str)
* Display a question.
*/
void
-ask(str)
- char *str;
+ask(char *str)
{
int len = strlen(str);
@@ -249,9 +245,7 @@ ask(str)
}
int
-get_line(buf, size)
- char *buf;
- int size;
+get_line(char *buf, int size)
{
char *cp, *end;
int c = EOF;
diff --git a/games/gomoku/main.c b/games/gomoku/main.c
index 68805f92a7d..cfae259b279 100644
--- a/games/gomoku/main.c
+++ b/games/gomoku/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.31 2016/01/07 16:00:32 tb Exp $ */
+/* $OpenBSD: main.c,v 1.32 2016/01/08 21:38:33 mestre Exp $ */
/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
@@ -68,9 +68,7 @@ char *plyr[2]; /* who's who */
static char you[LOGIN_NAME_MAX]; /* username */
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
char buf[128];
char fname[PATH_MAX];
@@ -320,12 +318,10 @@ again:
}
}
quit(0);
- /* NOTREACHED */
}
int
-readinput(fp)
- FILE *fp;
+readinput(FILE *fp)
{
char *cp;
int c;
@@ -342,8 +338,7 @@ readinput(fp)
* Handle strange situations.
*/
void
-whatsup(signum)
- int signum;
+whatsup(int signum)
{
int i, pnum, n, s1, s2, d1, d2;
struct spotstr *sp;
@@ -491,8 +486,7 @@ syntax:
* Display debug info.
*/
void
-dlog(str)
- char *str;
+dlog(char *str)
{
if (debugfp)
@@ -504,8 +498,7 @@ dlog(str)
}
void
-logit(str)
- char *str;
+logit(char *str)
{
if (debugfp)
@@ -520,8 +513,7 @@ logit(str)
* Deal with a fatal error.
*/
void
-qlog(str)
- char *str;
+qlog(char *str)
{
dlog(str);
if (interactive)
@@ -530,10 +522,8 @@ qlog(str)
quit(0);
}
-/* ARGSUSED */
void
-quit(sig)
- int sig;
+quit(int sig)
{
if (interactive) {
bdisp(); /* show final board */
@@ -546,8 +536,7 @@ quit(sig)
* Die gracefully.
*/
void
-panic(str)
- char *str;
+panic(char *str)
{
fprintf(stderr, "%s: %s\n", __progname, str);
fputs("resign\n", stdout);
diff --git a/games/gomoku/makemove.c b/games/gomoku/makemove.c
index f9cc487c513..b36dff882ad 100644
--- a/games/gomoku/makemove.c
+++ b/games/gomoku/makemove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makemove.c,v 1.7 2009/10/27 23:59:24 deraadt Exp $ */
+/* $OpenBSD: makemove.c,v 1.8 2016/01/08 21:38:33 mestre Exp $ */
/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
@@ -49,8 +49,7 @@ int weight[5] = { 0, 1, 7, 22, 100 };
* TIE The game is a tie.
*/
int
-makemove(us, mv)
- int us, mv;
+makemove(int us, int mv)
{
struct spotstr *sp, *fsp;
union comboval *cp;
@@ -207,14 +206,13 @@ makemove(us, mv)
* fix up the overlap array due to updating spot osp.
*/
void
-update_overlap(osp)
- struct spotstr *osp;
+update_overlap(struct spotstr *osp)
{
struct spotstr *sp, *sp1, *sp2;
int i, f, r, r1, d, d1, n;
int a, b, bmask, bmask1;
struct spotstr *esp = NULL;
- char *str;
+ u_char *str;
for (r = 4; --r >= 0; ) { /* for each direction */
d = dd[r];
diff --git a/games/gomoku/pickmove.c b/games/gomoku/pickmove.c
index ab8ac3364b5..33d6e149522 100644
--- a/games/gomoku/pickmove.c
+++ b/games/gomoku/pickmove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pickmove.c,v 1.15 2016/01/04 17:33:24 mestre Exp $ */
+/* $OpenBSD: pickmove.c,v 1.16 2016/01/08 21:38:33 mestre Exp $ */
/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
@@ -56,8 +56,7 @@ int tmpmap[MAPSZ]; /* map for blocking <1,x> combos */
int nforce; /* count of opponent <1,x> combos */
int
-pickmove(us)
- int us;
+pickmove(int us)
{
struct spotstr *sp, *sp1, *sp2;
union comboval *Ocp, *Tcp;
@@ -159,10 +158,7 @@ pickmove(us)
* Return true if spot 'sp' is better than spot 'sp1' for color 'us'.
*/
int
-better(sp, sp1, us)
- struct spotstr *sp;
- struct spotstr *sp1;
- int us;
+better(struct spotstr *sp, struct spotstr *sp1, int us)
{
int them, s, s1;
@@ -216,8 +212,7 @@ int curlevel; /* implicit parameter to makecombo() */
* Also, try to combine frames to find more complex (chained) moves.
*/
void
-scanframes(color)
- int color;
+scanframes(int color)
{
struct combostr *cbp, *ecbp;
struct spotstr *sp;
@@ -404,11 +399,7 @@ scanframes(color)
* within the frame 'ocbp' and combo value 's'.
*/
void
-makecombo2(ocbp, osp, off, s)
- struct combostr *ocbp;
- struct spotstr *osp;
- int off;
- int s;
+makecombo2(struct combostr *ocbp, struct spotstr *osp, int off, int s)
{
struct spotstr *fsp;
struct combostr *ncbp;
@@ -538,8 +529,7 @@ makecombo2(ocbp, osp, off, s)
* combinations of 'level' number of frames.
*/
void
-addframes(level)
- int level;
+addframes(int level)
{
struct combostr *cbp, *ecbp;
struct spotstr *sp, *fsp;
@@ -639,11 +629,7 @@ addframes(level)
* within the frame 'ocbp' and combo value 's'.
*/
void
-makecombo(ocbp, osp, off, s)
- struct combostr *ocbp;
- struct spotstr *osp;
- int off;
- int s;
+makecombo(struct combostr *ocbp, struct spotstr *osp, int off, int s)
{
struct combostr *cbp, *ncbp;
struct spotstr *sp;
@@ -792,8 +778,7 @@ struct combostr *ecombo[MAXDEPTH]; /* separate from elist to save space */
* in 'ocbp' that will complete the combo.
*/
void
-makeempty(ocbp)
- struct combostr *ocbp;
+makeempty(struct combostr *ocbp)
{
struct combostr *cbp, **cbpp;
struct elist *ep, *nep;
@@ -951,9 +936,7 @@ makeempty(ocbp)
* would be trying to "complete" the combo or trying to block it.
*/
void
-updatecombo(cbp, color)
- struct combostr *cbp;
- int color;
+updatecombo(struct combostr *cbp, int color)
{
struct spotstr *sp;
struct combostr *tcbp;
@@ -1041,8 +1024,7 @@ updatecombo(cbp, color)
* Add combo to the end of the list.
*/
void
-appendcombo(cbp)
- struct combostr *cbp;
+appendcombo(struct combostr *cbp)
{
struct combostr *pcbp, *ncbp;
@@ -1071,12 +1053,8 @@ appendcombo(cbp)
* 's' is the combo value for frame 'fcpb'.
*/
int
-checkframes(cbp, fcbp, osp, s, vertices)
- struct combostr *cbp;
- struct combostr *fcbp;
- struct spotstr *osp;
- int s;
- struct ovlp_info *vertices;
+checkframes(struct combostr *cbp, struct combostr *fcbp, struct spotstr *osp,
+ int s, struct ovlp_info *vertices)
{
struct combostr *tcbp, *lcbp = NULL;
int i, n, mask, flg, verts, idx, fcnt;
@@ -1209,10 +1187,8 @@ checkframes(cbp, fcbp, osp, s, vertices)
* Otherwise, add the new combo to the hash list.
*/
int
-sortcombo(scbpp, cbpp, fcbp)
- struct combostr **scbpp;
- struct combostr **cbpp;
- struct combostr *fcbp;
+sortcombo(struct combostr **scbpp, struct combostr **cbpp,
+ struct combostr *fcbp)
{
struct combostr **spp, **cpp;
struct combostr *cbp, *ecbp;
@@ -1327,10 +1303,7 @@ inserted:
* Print the combo into string 'str'.
*/
void
-printcombo(cbp, str, strl)
- struct combostr *cbp;
- char *str;
- size_t strl;
+printcombo(struct combostr *cbp, char *str, size_t strl)
{
char *basestr = str;
struct combostr *tcbp;
@@ -1349,8 +1322,7 @@ printcombo(cbp, str, strl)
#ifdef DEBUG
void
-markcombo(ocbp)
- struct combostr *ocbp;
+markcombo(struct combostr *ocbp)
{
struct combostr *cbp, *tcbp, **cbpp;
struct elist *ep, *nep, **epp;
@@ -1464,9 +1436,7 @@ markcombo(ocbp)
}
void
-clearcombo(cbp, open)
- struct combostr *cbp;
- int open;
+clearcombo(struct combostr *cbp, int open)
{
struct spotstr *sp;
struct combostr *tcbp;
@@ -1485,10 +1455,7 @@ clearcombo(cbp, open)
}
int
-list_eq(scbpp, cbpp, n)
- struct combostr **scbpp;
- struct combostr **cbpp;
- int n;
+list_eq(struct combostr **scbpp, struct combostr **cbpp, int n)
{
struct combostr **spp, **cpp;
diff --git a/games/gomoku/stoc.c b/games/gomoku/stoc.c
index 31a040d1b10..57ccbaf452c 100644
--- a/games/gomoku/stoc.c
+++ b/games/gomoku/stoc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: stoc.c,v 1.10 2016/01/04 17:33:24 mestre Exp $ */
+/* $OpenBSD: stoc.c,v 1.11 2016/01/08 21:38:33 mestre Exp $ */
/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
@@ -54,8 +54,7 @@ static struct mvstr mv[] = {
* Turn the spot number form of a move into the character form.
*/
char *
-stoc(s)
- int s;
+stoc(int s)
{
static char buf[32];
int i;
@@ -71,8 +70,7 @@ stoc(s)
* Turn the character form of a move into the spot number form.
*/
int
-ctos(mp)
- char *mp;
+ctos(char *mp)
{
int i;
@@ -91,8 +89,7 @@ ctos(mp)
* Turn a letter into a number.
*/
int
-lton(c)
- int c;
+lton(int c)
{
int i;