History log of /src/games/gomoku/pickmove.c |
Revision | | Date | Author | Comments |
1.68 |
| 29-May-2022 |
rillig | gomoku: clean up variable names, add empty lines
No binary change.
|
1.67 |
| 29-May-2022 |
rillig | gomoku: clean up color handling in 'pickmove'
Instead of searching for the best black and white moves, search instead for our and their best moves. This makes the code simpler and more uniform, as the strategy is the same for Black and White.
No functional change.
|
1.66 |
| 29-May-2022 |
rillig | gomoku: clean up 'pickmove' stylistically
No functional change.
|
1.65 |
| 29-May-2022 |
rillig | gomoku: migrate remaining functions to type player_color
No functional change.
|
1.64 |
| 29-May-2022 |
rillig | gomoku: clean up overlap info in 'checkframes'
In 2009, GCC had complained that the overlap_info might only be partially filled. All possible code paths are sane though, so that was probably a bug in GCC.
Remove the comment and the unnecessary initialization, rename the variable since it doesn't match its behavior anymore. Sync nearby comments with reality; there is no array anywhere near.
No functional change.
|
1.63 |
| 29-May-2022 |
rillig | gomoku: do not scan the upper border for combos
Adding the '+ 1' to the row coordinate added an offset of 20, while the intended offset was 1.
No functional change, just a bit faster.
|
1.62 |
| 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.61 |
| 29-May-2022 |
rillig | gomoku: add type player_color
No functional change.
|
1.60 |
| 29-May-2022 |
rillig | gomoku: use unsigned integers for bit sets
As all access to the bit sets happens through the unsigned spot_index type, drop the type casts in the macros.
No functional change on 2s complement machines.
|
1.59 |
| 29-May-2022 |
rillig | gomoku: don't use 'i' as special-purpose variable name
No binary change.
|
1.58 |
| 29-May-2022 |
rillig | gomoku: consistently name the offset of a spot in a frame 'off'
Leave 'i' for general purpose loops.
No functional change.
|
1.57 |
| 29-May-2022 |
rillig | gomoku: add data type for one of the 4 directions of a frame
No functional change.
|
1.56 |
| 29-May-2022 |
rillig | gomoku: clean up four_in_a_row
No functional change.
|
1.55 |
| 29-May-2022 |
rillig | gomoku: extract quick_check from scanframes
No functional change.
|
1.54 |
| 29-May-2022 |
rillig | gomoku: use proper types when indexing 'board' and 'frames'
No functional change.
|
1.53 |
| 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.52 |
| 29-May-2022 |
rillig | gomoku: document where to fix the unnecessarily long thinking time
|
1.51 |
| 29-May-2022 |
rillig | gomoku: migrate pickmove to use spot_index instead of pointers
Using spot_index instead of pointers leads to simpler code since there is no need to deal with conversion from ptrdiff_t to spot_index.
No functional change.
|
1.50 |
| 29-May-2022 |
rillig | gomoku: migrate spot_index from int to unsigned short
This matches the type of 'intersect'.
No functional change.
|
1.49 |
| 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.48 |
| 28-May-2022 |
rillig | gomoku: use unsigned arithmetic for bitboard
No functional change.
|
1.47 |
| 28-May-2022 |
rillig | gomoku: group movelog and nmoves into a game struct
No functional change.
|
1.46 |
| 27-May-2022 |
rillig | gomoku: reduce scope of local variables
No binary change.
|
1.45 |
| 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.44 |
| 27-May-2022 |
rillig | gomoku: split local variable into separate variables
No binary change.
|
1.43 |
| 22-May-2022 |
rillig | gomoku: document a missed immediate win
No binary change.
|
1.42 |
| 21-May-2022 |
rillig | gomoku: provide readable names for c.a and c.b
No binary change.
|
1.41 |
| 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.40 |
| 21-May-2022 |
rillig | gomoku: prevent thinking for too long
At search depth 9, picking a move takes about a minute on modern hardware, which is enough for casual game play. Even then, gomoku does not always find the perfect move, so investing that much time seems questionable. Limiting the search depth also puts an upper bound on the memory usage, which is quite high with 150 MB.
|
1.39 |
| 20-May-2022 |
rillig | gomoku: fix spelling and grammar in comments
|
1.38 |
| 19-May-2022 |
rillig | gomoku: remove unused function 'list_eq'
|
1.37 |
| 19-May-2022 |
rillig | gomoku: use NULL instead of more verbose null pointer
No binary change.
|
1.36 |
| 19-May-2022 |
rillig | gomoku: clean up version control sections
Lint can handle these definitions, and the '#if 0' is redundant.
No functional change.
|
1.35 |
| 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.34 |
| 18-May-2022 |
rillig | gomoku: reduce scope of 'for' loop variables
No binary change.
|
1.33 |
| 16-May-2022 |
rillig | gomoku: enable lint's strict bool mode
No functional change.
|
1.32 |
| 16-May-2022 |
rillig | gomoku: fix most lint warnings in -DDEBUG mode
No binary change.
|
1.31 |
| 16-May-2022 |
rillig | gomoku: allow combination of WARNS=6 and -DDEBUG
|
1.30 |
| 16-May-2022 |
rillig | gomoku: prepare lint's strict bool mode
No binary change.
|
1.29 |
| 16-May-2022 |
rillig | gomoku: fix lint warnings
Most warnings were about implicit conversions from ptrdiff_t to int; add explicit cast for them, as they are far from overflowing int.
The casts from one pointer type to 'struct combostr **' were indeed suspicious. In these cases, a single region of memory is allocated to store two objects of different type, without declaring a struct type for their combination. The second object is an array of variable size.
No binary change.
|
1.28 |
| 16-May-2022 |
rillig | gomoku: condense code to decide which spot is better
The comments in the conditions only serve to align the expressions, to allow humans to check that they correspond.
No functional change.
|
1.27 |
| 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.26 |
| 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.25 |
| 15-May-2022 |
rillig | gomoku: remove redundant parentheses around return values
No binary change.
|
1.24 |
| 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.23 |
| 14-May-2022 |
rillig | gomoku: clean up unused code and lint warnings
No binary change.
|
1.22 |
| 19-Oct-2013 |
christos | fix unused variable warnings
|
1.21 |
| 13-Oct-2012 |
dholland | Pass -Wstrict-overflow... mostly.
|
1.20 |
| 29-Mar-2010 |
dholland | branches: 1.20.6; 1.20.12; remove #ifdef SVR4
|
1.19 |
| 12-Aug-2009 |
dholland | sprinkle static
|
1.18 |
| 04-Jun-2009 |
dholland | Rectify non-compiling code that appears when DEBUG is defined.
|
1.17 |
| 04-Jun-2009 |
dholland | Remove remaining references to sprintf.
|
1.16 |
| 04-Jun-2009 |
dholland | Make a couple of the logging/printing functions printf-alikes. This removes most of the calls to sprintf.
|
1.15 |
| 04-Jun-2009 |
dholland | Increase spending on vowels. No object file diffs.
|
1.14 |
| 04-Jun-2009 |
dholland | ANSIfy function declarations.x
|
1.13 |
| 28-Jan-2008 |
dholland | build with WARNS=4
|
1.12 |
| 15-Dec-2007 |
perry | convert __attribute__s to applicable cdefs.h macros
|
1.11 |
| 27-Jan-2004 |
jsm | branches: 1.11.22; Include <limits.h> instead of <machine/limits.h>.
|
1.10 |
| 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.9 |
| 18-Sep-1999 |
jsm | Fix -Wsign-compare warnings.
|
1.8 |
| 09-Sep-1999 |
jsm | Check for failure of malloc() and calloc() at various places in the games.
|
1.7 |
| 08-Sep-1999 |
jsm | Add `__noreturn__' and `__unused__' attributes 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).
Most noreturn attributes were previously added in bin/6144, with some others that were missed then in bin/8082. Previous `unused' attributes were covered in bin/6557, bin/8058 and other PRs (all these PRs have already been handled and closed).
|
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 |
| 10-Oct-1997 |
lukem | WARNSify
|
1.4 |
| 03-Jan-1997 |
cgd | fix NetBSD RCS ID headers
|
1.3 |
| 03-Jan-1997 |
cgd | include string.h and stdlib.h for prototypes, as appropriate
|
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.11.22.2 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.11.22.1 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.20.12.2 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.20.12.1 |
| 20-Nov-2012 |
tls | Resync to 2012-11-19 00:00:00 UTC
|
1.20.6.2 |
| 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")
|
1.20.6.1 |
| 30-Oct-2012 |
yamt | sync with head
|