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.
Previously, the (invalid) debug command 'o,' succeeded to parse and led
to out-of-bounds memory access. Add proper parsing for the arguments of
that debug command. Add a short usage for that debug command, as
guessing the usage from the previous code was time-consuming due to the
large amount of ad-hoc low-level parsing code.
When leaving debug mode, clear the debug prompt.
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.
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.
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.
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.
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.
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.
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.
Fix variable names 'ia' and 'ib', which I forgot in the previous commit.
Move the documentation in the right places.
Split off another part of init_overlap, to make each function fit on a
single screen. Reducing the number of nested 'for' loops allows the
indentation to follow the NetBSD style.
No functional change.
By clearly associating each variable to either frame A or frame B,
suddenly the code becomes understandable. For the benefit of future
readers, explain the naming scheme.
No functional change.
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.
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.