Home | History | Annotate | Download | only in gomoku
History log of /src/games/gomoku/bdisp.c
RevisionDateAuthorComments
 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: after accepting a spot via the mouse, clear current coordinate
 1.52  29-May-2022  rillig gomoku: don't use 'i' as special-purpose variable name

No binary change.
 1.51  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.50  28-May-2022  rillig gomoku: remove redundant parentheses, braces, newlines, clean up get_key

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

No functional change.
 1.47  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.46  22-May-2022  rillig gomoku: add mouse support

NetBSD 10 provides the mouse handling functions from <curses.h> but does
not actually implement the mouse handling. For the benefit of other
platforms, add mouse support; when linked with ncurses instead of
curses, it works.

Depending on the input device, mouse clicks are either reported as
"button 1 clicked" (mouse) or "button 1 pressed/released" (touchpad);
support both.

Be strict about the X coordinate when clicking. Since the coordinates
are integer numbers, getting the location between two spots is
ambiguous, as it could be just one pixel away or right in the middle of
the space between the spots.
 1.45  22-May-2022  rillig gomoku: clean up coordinate calculations in get_coord

No functional change.
 1.44  22-May-2022  rillig gomoku: make coordinates in get_coord 1-based

The rest of the game has 1-based coordinates as well.

No functional change.
 1.43  22-May-2022  rillig gomoku: extract save_game from main

No functional change.
 1.42  21-May-2022  rillig gomoku: right-align column header for move number
 1.41  21-May-2022  rillig gomoku: move comments closer to their corresponding entities

No binary change.
 1.40  21-May-2022  rillig gomoku: warn before overwriting a saved game file
 1.39  21-May-2022  rillig gomoku: do not accept overly long lines from the input

Typing beyond the screen and then pressing and holding backspace still
removes the prompt, just as before.
 1.38  21-May-2022  rillig gomoku: fix deleting a character when reading a line
 1.37  21-May-2022  rillig gomoku: make drawing the player's names simpler

No functional change.
 1.36  19-May-2022  rillig gomoku: use combined curses functions

To save some screen space in the source code and some bytes in the
generated binary.

No functional change.
 1.35  19-May-2022  rillig gomoku: clean up coordinate for the currently selected spot

There is no need to make this coordinate dependent on the board size.

No binary change.
 1.34  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.33  19-May-2022  rillig gomoku: replace magic numbers with proper coordinate calculation
 1.32  19-May-2022  rillig gomoku: properly center the player's names
 1.31  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.30  19-May-2022  rillig gomoku: fix error message for small screen

- gomoku: Screen too small (need 8018d)
+ gomoku: Screen too small (need 80x24)
 1.29  19-May-2022  rillig gomoku: fix type mismatch in call to curses function

Not yet detected by lint, as lint is more permissive for type mismatches
if the value is a constant 0. Being permissive doesn't make sense in
this case. Now the calls to 'keypad' and 'leaveok' are consistent.

No binary change.
 1.28  18-May-2022  rillig gomoku: reduce scope of 'for' loop variables

No binary change.
 1.27  16-May-2022  rillig gomoku: highlight the last played move
 1.26  16-May-2022  rillig gomoku: enable lint's strict bool mode

No functional change.
 1.25  16-May-2022  rillig gomoku: fix most lint warnings in -DDEBUG mode

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

No binary change.
 1.23  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.22  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.21  15-May-2022  rillig gomoku: remove redundant parentheses around return values

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

No binary change.
 1.18  02-May-2021  rillig games: remove trailing whitespace in *.c and *.h
 1.17  22-Mar-2014  dholland move extern decls to .h files
 1.16  18-Feb-2012  matt branches: 1.16.2;
Fix conflicting variable definitions
 1.15  29-Mar-2010  dholland branches: 1.15.6;
Some improvements to the new UI.
 1.14  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.13  29-Mar-2010  dholland Don't exit(0) on failure. Use errx() instead of fprintf.
 1.12  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.11  04-Jun-2009  dholland Increase spending on vowels. No object file diffs.
 1.10  04-Jun-2009  dholland ANSIfy function declarations.x
 1.9  08-Aug-2008  drochner if initscr() fails, exit with a message rather than crash in the
next curses call
 1.8  07-Aug-2003  agc branches: 1.8.32;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22269, verified by myself.
 1.7  05-Feb-2001  christos fix nested externs
 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.8.32.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.15.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.15.6.1  17-Apr-2012  yamt sync with head
 1.16.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.

RSS XML Feed