History log of /netbsd/games/gomoku/main.c (Results 1 – 25 of 73)
Revision Date Author Comments
# 9a5bb6dd 29-May-2022 rillig <rillig@NetBSD.org>

gomoku: migrate remaining functions to type player_color

No functional change.


# e74f9b39 29-May-2022 rillig <rillig@NetBSD.org>

gomoku: make parsing of the debug command 'o' robust

Previously, the (invalid) debug command 'o,' succeeded to parse and led
to out-of-bounds memory access. Add proper parsing for the arguments of
t

gomoku: make parsing of the debug command 'o' robust

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.

show more ...


# 16dd548a 29-May-2022 rillig <rillig@NetBSD.org>

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
c

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.

show more ...


# ad084773 29-May-2022 rillig <rillig@NetBSD.org>

gomoku: don't use 'i' as special-purpose variable name

No binary change.


# a3cf3e91 29-May-2022 rillig <rillig@NetBSD.org>

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 ch

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.

show more ...


# 50df4346 29-May-2022 rillig <rillig@NetBSD.org>

gomoku: migrate spot_index from int to unsigned short

This matches the type of 'intersect'.

No functional change.


# 52192ebc 29-May-2022 rillig <rillig@NetBSD.org>

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 a

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.

show more ...


# 94312f8e 28-May-2022 rillig <rillig@NetBSD.org>

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.


# 263896d1 28-May-2022 rillig <rillig@NetBSD.org>

gomoku: document that 'whatsup' is called on ^C as well


# 0e6abd56 28-May-2022 rillig <rillig@NetBSD.org>

gomoku: allow saving a finished game without pressing Shift


# 90f472e6 28-May-2022 rillig <rillig@NetBSD.org>

gomoku: remove redundant parentheses, braces, newlines, clean up get_key

No functional change.


# e6aac688 28-May-2022 rillig <rillig@NetBSD.org>

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 t

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.

show more ...


# e01290fe 28-May-2022 rillig <rillig@NetBSD.org>

gomoku: group movelog and nmoves into a game struct

No functional change.


# b1fcb64e 28-May-2022 rillig <rillig@NetBSD.org>

gomoku: extract update_overlap_different_direction

No functional change.


# 3aad785d 27-May-2022 rillig <rillig@NetBSD.org>

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

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.

show more ...


# 0bd15c19 22-May-2022 rillig <rillig@NetBSD.org>

gomoku: extract main_game_loop from main

No functional change.


# 8c8c8d69 22-May-2022 rillig <rillig@NetBSD.org>

gomoku: turn comments for testing mode into actual code

No functional change.


# df8ab5c5 22-May-2022 rillig <rillig@NetBSD.org>

gomoku: extract read_color from main

No functional change.


# a80f2c2f 22-May-2022 rillig <rillig@NetBSD.org>

gomoku: extract declare_winner from main


# 7eefc018 22-May-2022 rillig <rillig@NetBSD.org>

gomoku: extract ask_user_color from main

No functional change.


# 9e0db38c 22-May-2022 rillig <rillig@NetBSD.org>

gomoku: extract read_move from main

No functional change.


# 42c35140 22-May-2022 rillig <rillig@NetBSD.org>

gomoku: extract set_input_sources from main

No functional change.


# ee4f37e1 22-May-2022 rillig <rillig@NetBSD.org>

gomoku: extract parse_args from main

No functional change.


# 93015f22 22-May-2022 rillig <rillig@NetBSD.org>

gomoku: extract save_game from main

No functional change.


# 84572dc5 21-May-2022 rillig <rillig@NetBSD.org>

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
c

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]'.

show more ...


123