Home | History | Annotate | Download | only in gomoku
History log of /src/games/gomoku/gomoku.h
RevisionDateAuthorComments
 1.56  19-Jun-2022  rillig gomoku: reduce usage of magic numbers in the code

No binary change.
 1.55  29-May-2022  rillig gomoku: refine the type of some functions and variables

Assisted by WARNS=6. At that level, there are several warnings about
type conversion between small integer types that would only clutter the
code, therefore stay at WARNS=5. Same for lint's -aa option.

No functional change.
 1.54  29-May-2022  rillig gomoku: when starting a new game, start in the middle of the board

Previously, when starting a new game, the user coordinate was kept at
the previously selected spot. Since playing in the center is common
sense, reset the coordinate.
 1.53  29-May-2022  rillig gomoku: add type player_color

No functional change.
 1.52  29-May-2022  rillig gomoku: provide a more gentle introduction to the code

No binary change.
 1.51  29-May-2022  rillig gomoku: don't use 'i' as special-purpose variable name

No binary change.
 1.50  29-May-2022  rillig gomoku: add data type for one of the 4 directions of a frame

No functional change.
 1.49  29-May-2022  rillig gomoku: turn spotstr.s_frame into a frame index

Most calculations are done on the frame index, not the pointer. This
avoids dealing with ptrdiff_t conversion to int.

Changing the type of s_frame changes the size of struct spotstr, it is
now 56 bytes on LP64 and 48 bytes on ILP32, neither of which is a power
of two. Remove the dummy padding since compilers no longer generate
division instructions for divisions by small integer constants, so that
optimization is no longer necessary.

No functional change.
 1.48  29-May-2022  rillig gomoku: migrate spot_index from int to unsigned short

This matches the type of 'intersect'.

No functional change.
 1.47  29-May-2022  rillig 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.
 1.46  28-May-2022  rillig gomoku: use custom magic value for end of file input

This allows the type for a spot index to be changed to an unsigned type.

No functional change.
 1.45  28-May-2022  rillig gomoku: split initialization of the board into smaller functions

The comments about the "top border" and "bottom border" had been wrong
all the time. Mention the corners in the comments, to remove the magic
from the various '+ 1' in the code.

No functional change.
 1.44  28-May-2022  rillig gomoku: highlight the winning frame
 1.43  28-May-2022  rillig gomoku: group movelog and nmoves into a game struct

No functional change.
 1.42  28-May-2022  rillig gomoku: extract update_overlap_different_direction

No functional change.
 1.41  27-May-2022  rillig gomoku: reduce scope of local variables

No binary change.
 1.40  27-May-2022  rillig gomoku: replace 1-based movenum with 0-based nmoves

No functional change, not even the TIE that is wrongly announced when
the very last spot on the board is yet to be filled by Black. Even
without this off-by-one error, it could be that filling the very last
spot completes a frame, so that code has been wrong all the time.

In practical terms, this situation only arises when the human player is
unconcentrated or the computer player has a bad strategy. The latter
may well be, as the computer moves in the (boring) endgame are not
directed towards winning -- they fill irrelevant spots before relevant
ones.
 1.39  22-May-2022  rillig gomoku: document a missed immediate win

No binary change.
 1.38  21-May-2022  rillig gomoku: right-align column header for move number
 1.37  21-May-2022  rillig gomoku: provide readable names for c.a and c.b

No binary change.
 1.36  21-May-2022  rillig gomoku: move comments closer to their corresponding entities

No binary change.
 1.35  21-May-2022  rillig gomoku: inline macro MAXCOMBO

The name of the macro was not descriptive enough, the other constants in
bdinit also don't have names.

No binary change.
 1.34  21-May-2022  rillig gomoku: convert input source constants to an enum

I also tried converting other macros, but s_occ would use more memory
and the return values for makemove are special values, besides the usual
coordinates in the form PT(x, y), so turning the special values into an
enum would be confusing.

No functional change.
 1.33  21-May-2022  rillig gomoku: warn before overwriting a saved game file
 1.32  21-May-2022  rillig gomoku: make drawing the player's names simpler

No functional change.
 1.31  20-May-2022  rillig gomoku: fix spelling and grammar in comments
 1.30  19-May-2022  rillig gomoku: remove unused function 'list_eq'
 1.29  19-May-2022  rillig gomoku: de-obfuscate screen coordinate calculation

Modern compilers optimize linear integer arithmetic, so there is no
reason to use strange or misleading formulas.

Replace several magic numbers with proper formulas.

No binary change.
 1.28  16-May-2022  rillig gomoku: enable lint's strict bool mode

No functional change.
 1.27  16-May-2022  rillig gomoku: allow combination of WARNS=6 and -DDEBUG
 1.26  16-May-2022  rillig gomoku: prepare lint's strict bool mode

No binary change.
 1.25  15-May-2022  rillig 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.
 1.24  15-May-2022  rillig gomoku: remove write-only members from overlap_info

Since overlap_info is only used in pickmove.c, move it there.

No functional change. In particular, in the middle of a game, gomoku
still tends to fall into analysis paralysis, thinking about the best
move for more than 3 minutes on modern hardware. Since the algorithm is
basically unchanged since the 1990s, it must have been a long waiting
time back then, probably an hour per move.
 1.23  15-May-2022  rillig gomoku: remove column macros

Of the 19 macros, only 3 were actually used. Replace their uses with
expressions based on the board size. It's a small step to making the
board size adjustable. There are still other places using hard-coded
numbers.

No binary change.
 1.22  15-May-2022  rillig 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.
 1.21  14-May-2022  rillig gomoku: clean up unused code and lint warnings

No binary change.
 1.20  22-Mar-2014  dholland move extern decls to .h files
 1.19  29-Mar-2010  dholland branches: 1.19.6; 1.19.12;
Some improvements to the new UI.
 1.18  29-Mar-2010  dholland Better user interface. From OpenBSD, written by Paul Janzen quite a
long time ago. A few minor adjustments by yours truly.
 1.17  12-Aug-2009  dholland sprinkle static
 1.16  13-Jul-2009  roy Rename internal getline() function to get_line() so it does
conflict with the soon to be added getline(3) libc function.
 1.15  04-Jun-2009  dholland Remove global scratch string buffer. Don't zoom off the end while reading
user input, either.
 1.14  04-Jun-2009  dholland Remove remaining references to sprintf.
 1.13  04-Jun-2009  dholland Make a couple of the logging/printing functions printf-alikes. This removes
most of the calls to sprintf.
 1.12  04-Jun-2009  dholland attribute noreturn -> __dead
 1.11  04-Jun-2009  dholland Increase spending on vowels. No object file diffs.
 1.10  27-Jan-2004  jsm Remove uses of __P.
 1.9  27-Jan-2004  jsm Include <sys/endian.h>.
 1.8  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22269, verified by myself.
 1.7  13-Sep-1999  jsm Fix uses of names of library functions for other purposes.
 1.6  08-Sep-1999  jsm 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.
 1.5  13-Sep-1998  hubertf mark non-returning functions (PR#6144 by Joseph Myers <jsm28@cam.ac.uk>)
 1.4  10-Oct-1997  lukem WARNSify
 1.3  03-Jan-1997  cgd fix NetBSD RCS ID headers
 1.2  28-Dec-1996  tls add gomoku game, from 4.4BSD-Lite2
 1.1  28-Dec-1996  tls branches: 1.1.1;
Initial revision
 1.1.1.1  28-Dec-1996  tls Import of 4.4BSD-Lite2 source
 1.19.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.6.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")

RSS XML Feed