Commit Graph

21 Commits

Author SHA1 Message Date
rillig 76069dc145 gomoku: use consistent variable names
Previously, the name 's' was used for the index of a spot on the board,
as well as for the value of a combo, and for a few other purposes. Use
different names and mark the spot indexes using a custom type.

No binary change.
2022-05-29 00:12:11 +00:00
rillig 91e5439d10 gomoku: fix error handling when reading moves from a file
The columns of the board are labeled from A to H and J to T, which makes
I5 or i5 an invalid coordinate.  Previously, reading this invalid
coordinate from a file resulted in the string "<6" appearing in the move
log.

The 'i' was converted into the nonexistent column 20, and PT(20, 5) got
an out-of-bounds argument, resulting in spot 120.  Converting this spot
back into coordinates resulted in PT(0, 6).  The '<' comes from
'letters[0]'.
2022-05-21 19:02:14 +00:00
rillig be456ab9a1 gomoku: right-align column header for move number 2022-05-21 17:19:10 +00:00
rillig e80842a607 gomoku: clean up version control sections
Lint can handle these definitions, and the '#if 0' is redundant.

No functional change.
2022-05-19 22:19:18 +00:00
rillig 40aee379df gomoku: reduce scope of 'for' loop variables
No binary change.
2022-05-18 22:30:19 +00:00
rillig af50285f47 gomoku: inline macros BSZ1, BSZ2, BSZ3, BSZ4
These macro names didn't convey any meaning, so replace them with their
replacement text, to have fewer identifiers to worry about.

No binary change.
2022-05-15 22:56:20 +00:00
rillig 0a647d356c gomoku: remove redundant parentheses around return values
No binary change.
2022-05-15 22:08:05 +00:00
rillig ee07f44521 gomoku: apply some style fixes towards KNF
There are still parts of the code that use an indentation level of 4
instead of the usual 8.  Fixing that right now would introduce more
unnatural line breaks, so defer that until later.

No binary change.
2022-05-15 22:00:11 +00:00
rillig 1182a44c59 games: remove trailing whitespace in *.c and *.h 2021-05-02 12:50:43 +00:00
dholland bc0970cff2 sprinkle static 2009-08-12 06:19:17 +00:00
dholland 02e6a3b1d0 sprintf -> snprintf 2009-06-04 05:51:12 +00:00
dholland 881e77fbe7 ANSIfy function declarations.x 2009-06-04 05:27:04 +00:00
rillig 4f6457e756 Fixed wrong use of the <ctype.h> functions by adding an explicit conversion
to unsigned char. Approved by christos.
2005-04-19 20:14:29 +00:00
dsl 49f7d8a9b1 Add (unsigned char) cast to ctype functions 2004-11-05 21:30:31 +00:00
agc e5aeb4ea46 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22269, verified by myself.
2003-08-07 09:36:50 +00:00
matt 3233065035 More include additions for exit, abs, strcmp, etc. 2000-07-03 03:57:39 +00:00
jsm 092d313019 Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the
NetBSD games, except in hunt (where substantial changes from OpenBSD
need to be looked at).

Some such changes were previously covered in PRs bin/6041, bin/6146,
bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994,
bin/8039, bin/8057 and bin/8093.
1999-09-08 21:17:44 +00:00
lukem fa94a71b0a WARNSify 1997-10-10 13:36:01 +00:00
cgd a49cb38bf5 fix NetBSD RCS ID headers 1997-01-03 01:35:23 +00:00
tls 76940923a3 add gomoku game, from 4.4BSD-Lite2 1996-12-28 18:56:57 +00:00
tls 193cec78aa Import of 4.4BSD-Lite2 source 1996-12-28 18:44:55 +00:00