Introduction
Introduction Statistics Contact Development Disclaimer Help
add option to not highlight the last played move or checks or checkmates - ches…
git clone git://git.codemadness.org/chess-puzzles
Log
Files
Refs
README
LICENSE
---
commit b157d49005e4d9fd2e5e979b72a1e222e21fdec3
parent 52d9636da4a82de476f21b1c61de8b7570f96c92
Author: Hiltjo Posthuma <[email protected]>
Date: Thu, 29 Feb 2024 19:02:30 +0100
add option to not highlight the last played move or checks or checkmates
This is better for puzzles/training. Sometimes the last played move gives a
hint of a blunder etc.
This adds an extra challenge to analyze more properties of the position.
Diffstat:
M fen.1 | 8 ++++++--
M fen.c | 20 +++++++++++++-------
2 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/fen.1 b/fen.1
@@ -1,4 +1,4 @@
-.Dd January 14, 2024
+.Dd February 29, 2024
.Dt FEN 1
.Os
.Sh NAME
@@ -6,7 +6,7 @@
.Nd parses chess FEN, plays moves and writes output
.Sh SYNOPSIS
.Nm
-.Op Fl cCfF
+.Op Fl cCfFhH
.Op Fl l
.Op Fl m mapping
.Op Fl o Ar ascii | fen | pgn | speak | svg | tty
@@ -34,6 +34,10 @@ Disable board coordinates.
Flip the board, default is off.
.It Fl F
Do not flip the board.
+.It Fl h
+Highlight the last played move and checks or checkmates.
+.It Fl H
+Do not highlight the last played move and checks or checkmates.
.It Fl l
For PGN and speak mode only output the last move.
For PGN this will not prefix the move number.
diff --git a/fen.c b/fen.c
@@ -100,6 +100,7 @@ struct board {
int flipboard; /* flip board ? default: 0 */
int showcoords; /* board coordinates? default: 1 */
+ int highlights; /* highlight moves and checks? default: 1 */
struct theme *theme; /* board theme */
};
@@ -129,6 +130,7 @@ board_init(struct board *b)
b->movenumber = 1;
b->flipboard = 0;
b->showcoords = 1;
+ b->highlights = 1;
b->theme = &themes[0]; /* use first theme as default */
}
@@ -1388,13 +1390,15 @@ board_playmoves(struct board *b, const char *moves)
}
/* highlight last move */
- highlightmove(b, x, y);
- highlightmove(b, x2, y2);
-
- /* highlight king in check or mate */
- if (isincheck(b, b->side_to_move) &&
- findking(b, b->side_to_move, &x, &y))
- highlightcheck(b, x, y);
+ if (b->highlights) {
+ highlightmove(b, x, y);
+ highlightmove(b, x2, y2);
+
+ /* highlight king in check or mate */
+ if (isincheck(b, b->side_to_move) &&
+ findking(b, b->side_to_move, &x, &y))
+ highlightcheck(b, x, y);
+ }
}
void
@@ -1600,6 +1604,8 @@ main(int argc, char *argv[])
case 'd': dutchmode = 1; break; /* top secret dutch mo…
case 'f': board.flipboard = 1; break;
case 'F': board.flipboard = 0; break;
+ case 'h': board.highlights = 1; break;
+ case 'H': board.highlights = 0; break;
case 'l': onlylastmove = 1; silent = 1; break;
case 'm': /* remap PGN */
if (i + 1 >= argc)
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.