xboard.git
2 years agoImplement symmetrized books
H.G.Muller [Mon, 4 Jul 2022 18:43:59 +0000]
Implement symmetrized books

Variants with a symmetric setup, (such as Xiangqi and Janggi) only need
to store half the positions. This is now implemented for books with
a filename *-sym.bin. For each position a 'canonical representation'
is defined, which is either the position itself or its mirror image,
depending on the first left-right difference. The book is then probed
for the cannonical representation, and the retreived moves are flipped
to the original representation when needed.

2 years agoFix Janggi move and notation bugs
H.G.Muller [Mon, 4 Jul 2022 18:20:39 +0000]
Fix Janggi move and notation bugs

Elephant blocking was not correctly tested, and there were some
problems with disambiguation, in particular of Pawn moves inside
the Palace (where we now always fully disambiguate).

2 years agoFix null move
H.G.Muller [Mon, 4 Jul 2022 17:57:25 +0000]
Fix null move

2 years agoFix book probe on Machine Black
H.G.Muller [Mon, 4 Jul 2022 17:52:56 +0000]
Fix book probe on Machine Black

Not sure why this was needed anymore.

2 years agoJanggi is added to the known variants
H.G.Muller [Mon, 4 Jul 2022 17:49:28 +0000]
Janggi is added to the known variants

2 years agoFix turn pass
H.G.Muller [Mon, 4 Jul 2022 17:46:34 +0000]
Fix turn pass

There was a conflict between flagging and turn passing in games where
the latter is allowed; now flagging always has priority. Whether
null move is allowed is now derived from PosFlags().

2 years agoIntroduce VariantFamily PGN tag
H.G.Muller [Mon, 4 Jul 2022 17:03:45 +0000]
Introduce VariantFamily PGN tag

For engine-defined variants this indicates the parent variant.
When a game with this tag is loaded a variant switch is always forced.

2 years agoAlways copy 6 castling rights for incomplete FEN
H.G.Muller [Mon, 4 Jul 2022 14:24:51 +0000]
Always copy 6 castling rights for incomplete FEN

The number of castling rights might not be known at the time the
FEN is read, in a setup command.

2 years agoIncrease size of input buffer
H.G.Muller [Mon, 4 Jul 2022 10:50:52 +0000]
Increase size of input buffer

Some engines send a very long variant feature...

4 years agoFix diagonal moves Janggi in opponent Palace
H.G.Muller [Thu, 8 Oct 2020 14:17:38 +0000]
Fix diagonal moves Janggi in opponent Palace

The test for being in Palace should not refer to the Palace of your
own color, but to the Palace on your current board half. Also, Cannons
should not be able to jump over or capture each other inside the Palace.

4 years agoEnable null moving in Janggi
H.G.Muller [Thu, 8 Oct 2020 08:34:41 +0000]
Enable null moving in Janggi

4 years agoFix spurious promotion for redefined Pawns in Xiangqi
H.G.Muller [Wed, 7 Oct 2020 21:20:14 +0000]
Fix spurious promotion for redefined Pawns in Xiangqi

The Betza move generator, used for pieces with moves redefined by the
'piece' command, always generated Pawn moves to last rank as promotions.
In Xiangqi this had the undesired effect that promotion suffixes were
considered missing on such moves arriving as text, and a default promotion
to Queen was appended to them. Which made the Pawns disappear, as a Queen
normally does not participate in Xiangqi.
  Now the MovesFromString routine suppresses promotion in Xiangqi and
Janggi. It still doesn't pay attention to zone depth in other variants.

4 years agoFix WinBoard front-end for Janggi
H.G.Muller [Wed, 7 Oct 2020 08:25:34 +0000]
Fix WinBoard front-end for Janggi

The board checkering for Janggi should be the same as for Xiangqi,
but in WinBoard such decisions are taken in the front-end. Also
whether a certain board size is available with built-in piece images.

4 years agoSome fixes to Jianggi rules
H.G.Muller [Wed, 7 Oct 2020 07:09:42 +0000]
Some fixes to Jianggi rules

Janggi must be treated like Xiangqi in terms of royalty and (lack of)
promotion and e.p. capture. Also, Pawns must be able to move diagonally
inside the Palace.

4 years agoImplement Janggi as standard variant
H.G.Muller [Tue, 6 Oct 2020 18:25:06 +0000]
Implement Janggi as standard variant

The rules of Janggi (Korean Chess) are so peculiar amd unique that
it doesn't make sense to support them in terms of general applicable
features that can be configured by the engine. So the rules are now
hard-coded, and a new standard variant 'janggi' is added to select them.
This commit just takes care of the piece moves and initial position.

4 years agoFix PV conversion to SAN during pondering
H.G.Muller [Sat, 3 Oct 2020 10:17:30 +0000]
Fix PV conversion to SAN during pondering

Converting ponder PVs to SAN did not work when the ponder move was
given through a Hint command, rather than prefixed to the PV is
parentheses. Also, during TwoMachines mode, the conversion was not
invoked at all during pondering (as PV handling is done by another
code section in that case).

4 years agoRefactor ApplyMove
H.G.Muller [Fri, 29 May 2020 18:02:51 +0000]
Refactor ApplyMove

Almost all the cases in the large if-then-else sequence for the various
special moves examined the from-square and the set it to empty.
While a copy of the from-square was already in the variable 'piece'.
We now moved setting piece to the very beginning of the handling of
non-drop moves, and clear the from-square immediately after that,
instead of all the cases separately.

4 years agoImplement move borrowing in XBetza
H.G.Muller [Sun, 31 May 2020 19:15:44 +0000]
Implement move borrowing in XBetza

The XBetza 'x' modifier can now be used in final legs to indicate move
borrowing from a friendly target. This only works when the target's move
had an XBetza definition (i.e. was defined by a 'piece' command).
Although borrowing from equal type is suppressed, there is a danger
of infinite recursion when two different move borrowers occur in one game.
XBoard tries to suppress recursive move borrowing in general, by not
executing borrowing specs in a borrowed move, but a preceding leg can
hide this.

4 years agoFix oblique multi-leg moves in XBetza
H.G.Muller [Sun, 31 May 2020 17:22:29 +0000]
Fix oblique multi-leg moves in XBetza

Continuation legs of oblique atoms have thei directional modifiers
interpreted in the K system. But this had as an intended side effect
that they were split into a diagonal and orthogonal atom for separate
treatment, which for obliques is of course not possible, nor needed.
So this code is bypassed for the obliques now.

4 years agoImplement move indcution in XBeta
H.G.Muller [Sun, 31 May 2020 17:19:04 +0000]
Implement move indcution in XBeta

A non-final leg with 'x' modifier is recognized as an induction step
that would endow a friend at its target position with the move
specified in the remaining legs.

fix

4 years agoAllow redefinition of promotion choice for entire game
H.G.Muller [Sun, 31 May 2020 11:59:16 +0000]
Allow redefinition of promotion choice for entire game

The CECP ' choice'  command can now also be used at the start of a game
in an engine-defined variant (or variant fairy), (in response to the
'variant' command) to pre-emptively redefine the promotion choice for
the remainder of that game.

4 years agoImplement XBetza unload modifier
H.G.Muller [Sun, 31 May 2020 11:13:13 +0000]
Implement XBetza unload modifier

Move legs containing a 'u' modifier will cause a piece captured
or destroyed by the entire move to reappear on the starting square of
that leg. This allows specification of swappers and pieces that push
other pieces elsewhere. The encoding of the corresponding moves uses
the same format as that for locust capture, and ApplyMove() distinguishes
those from the occupation of the specified 'kill square'. For now
this can only be used in a move without other (true) locust capture.
Notation (SAN), and reading back of such moves is still unsolved.

4 years agoRefactor ApplyMove
H.G.Muller [Fri, 29 May 2020 18:02:51 +0000]
Refactor ApplyMove

Almost all the cases in the large if-then-else sequence for the various
special moves examined the from-square and the set it to empty.
While a copy of the from-square was already in the variable 'piece'.
We now moved setting piece to the very beginning of the handling of
non-drop moves, and clear the from-square immediately after that,
instead of all the cases separately.

4 years agoAllow entry of shogi promotions in any variant
H.G.Muller [Thu, 28 May 2020 20:41:24 +0000]
Allow entry of shogi promotions in any variant

Defining pieces as shogi-promotion partners did not cause triggering
of the promotion procedure when the corresponding basic piece reached
the zone for variants other than (Chu) Shogi. Now HasPromotionChoice()
recognizes pieces with a partner with ID '+' as promoting in any variant.
In variant fairy promotion on leaving the zone is now suppressed.
(This used to be only the case in variant elven.) This allows two-stage
promotions, where a Pawn first promote to a basic piece, and after leaving
the zone, the basic piece can promote again to its fixed partner.
(Like in Chess and a Half.)

4 years agoImplement feature dice
H.G.Muller [Tue, 26 May 2020 17:23:45 +0000]
Implement feature dice

An engine can now request XBoard to make a 'dice roll', by sending a
command "dice N", where N is the number of faces on the die. XBoard
will reply to such a request with "pips K/N", where K is a random
number 1...N, and N the N of the request. Multiple dice rolls can be
listed in a single dice or pips command, separated by spaces.
  In Two Machines mode only the requests of the engine that is on move
will be honored (as it is assumed that both engines would put in a
request for the same dice roll), but the 'pips' reply will then be
sent to both engines. (So the opponent can verify whether the opponent
did not cheat by specifying wrong N or ignoring K.)
  When playing against a human the engine can request for both sides
to make it easy for the human. The accumulated results of all rolls
during the turn will be shown to the user in the title bar of the board
window, to also exposes cheating by requesting until you like the result.
When the user's roll is displayed, the previous series of rolls (from
the engine's turn) is shown behind it in parentheses, to make sure the
user gets the chance to see it when the engine moves instantly.
  A Boolean feature dice is added, to enable the engine to see if
it is safe to send the 'dice' command (based on acceptance of the
feature), and for the GUI whether it is safe to send the 'pips'
to the opponent of the requestor. On rejection of the feature the engine
would have to use an alternative way (either generate the randoms by
itself, or use 'askuser' to request the user to roll the dice and enter
the result, with no guarantees against cheating by the active party).

4 years agoFix WinBoard clock messages
H.G.Muller [Thu, 9 Apr 2020 12:12:16 +0000]
Fix WinBoard clock messages

Using the message argument without copying it first permanently
stripped off the second line in logo mode, so that it would not
be displayed after changing side to move. A compile error had
crept in too.

4 years agoImprove Edit Position
H.G.Muller [Tue, 7 Apr 2020 11:52:23 +0000]
Improve Edit Position

The function of clock clicks is now displayed on the clocks.

4 years agoFacilitate swapping clock messages
H.G.Muller [Tue, 7 Apr 2020 10:11:33 +0000]
Facilitate swapping clock messages

The routine SetClockMessage() now copies the message of the other clock
when it gets passed an empty string. To erase a message, we must pass
a NULL argument.

4 years agoAllow printing of arbitrary messages in clocks
H.G.Muller [Tue, 7 Apr 2020 09:44:05 +0000]
Allow printing of arbitrary messages in clocks

A new front-end routine SetClockMessage() can now be used to specify
an arbitrary message for display in the mentioned clock. Once specified
as a non-empty string, this message will overrule the time string
when the clocks are refreshed though their normal routines.

4 years agoAllow larger error popups (WB)
H.G.Muller [Mon, 6 Apr 2020 21:17:52 +0000]
Allow larger error popups (WB)

The WinBoard error popup, also used for notes, is fixed size,
and cannot show more than 4 lines of text without clipping. In case
the message is more than 4 lines it now switches to a larger dialog.
This was needed for showing the explanation of the new Edit Position
method.

4 years agoRefactor clock display code
H.G.Muller [Mon, 6 Apr 2020 21:02:37 +0000]
Refactor clock display code

The functions DisplayTimerLabel() in XBoard and DisplayAClock() in
WinBoard now first create the text to display in a buffer, with the
possible line break in logo mode indicated as underscore. This
underscore is then later replaced by linefeed or space, depending
on whether we want a one-line or two-line clock. This as preparation
for also printing other texts.

4 years agoFix matches from set-up position in engine-defined variants
H.G.Muller [Mon, 6 Apr 2020 17:43:21 +0000]
Fix matches from set-up position in engine-defined variants

Unfortunately XBoard loads positions from a position file before it
starts the engine for the next game in a match. For an engine-defined
game this means the engine did not get the opportunity to define a
pieceToCharTable with its 'setup'  command before the FEN is parsed,
with as a result that non-standard pieces in the FEN will not be
recognized. This is now fixed in a kludgy way, by remembering the
pieceToCharTable an engine sends as a first response to the 'variant'
command, and using that for the next game in a match as well, before
attempting to parse the FEN.

4 years agoAdapt gating legality test to holdingless case
H.G.Muller [Mon, 6 Apr 2020 17:34:22 +0000]
Adapt gating legality test to holdingless case

The test in Disambiguate() to see if an indicated gating is legal
now is aware that in holdingless Seirawan gating takes place on the
second rank. It also reserves the test for RxK castling to the case
with holdings.

4 years agoFix printing SAN promotion in holdingless Seirawan
H.G.Muller [Mon, 6 Apr 2020 17:21:33 +0000]
Fix printing SAN promotion in holdingless Seirawan

CoordsToAlgebraic() was not recognizing a two-step King move as a
castling when it did not start from the back rank, and consequently
did not generate O-O or O-O-O for it. And in holdingless Seirawan
the King starts on the 2nd rank...

4 years agoMake gating mandatory in holdingless Seirawan
H.G.Muller [Mon, 6 Apr 2020 17:14:30 +0000]
Make gating mandatory in holdingless Seirawan

Moving a piece 'in front of' a gatable piece is made mandatory,
by supplying the missing gating suffix in the move parser. To
achieve this the move type returned by LegalityTast() for a move
with missing suffix is White/BlackPromotion, even when the move is
a castling. The parser then adds the suffix, like it does for any
promotion without a suffix.

4 years agoPrevent empty squares on holdings rank in Edit Position
H.G.Muller [Sun, 5 Apr 2020 21:01:25 +0000]
Prevent empty squares on holdings rank in Edit Position

When a piece is moved away from the gating rank in holdingless Seirawan,
the evacuated square is now automatically blacked out.

4 years agoLet gatee disappear on capture of its gator
H.G.Muller [Sun, 5 Apr 2020 20:57:43 +0000]
Let gatee disappear on capture of its gator

In holdingless Seirawan the piece behind a captured back-rank piece
now also is disappeared (and replaced by a dark square).

4 years agoAllow engine to add Prelude tag to PGN
H.G.Muller [Sun, 5 Apr 2020 20:48:10 +0000]
Allow engine to add Prelude tag to PGN

The engine can now use a 'tellothers prelude XXX' command at the start
of a game to cause adding of a PGN Prelude tag with value XXX when the
game later is saved.

4 years agoUse !-prefix instead of variant prelude
H.G.Muller [Sun, 5 Apr 2020 20:41:57 +0000]
Use !-prefix instead of variant prelude

That a 'setup' command is non-final is now indicated by an exclamation
point in front of the parent-variant name, rather than by using 'prelude'
as a parent. This way the true parent can be uknown from the beginning.

4 years agoFix starting from FEN in engine-defined variant
H.G.Muller [Sun, 5 Apr 2020 19:14:45 +0000]
Fix starting from FEN in engine-defined variant

The default start position of the variant as sent in the ' setup' command
should now no longer be able to overwrite the set-up position.

4 years agoSuppress testing of holdings in holdingless seirawan
H.G.Muller [Wed, 1 Jan 2020 19:17:46 +0000]
Suppress testing of holdings in holdingless seirawan

The legality test in variant seirawan normally tests if a piece specified
for gating is indeed in hand. This is now suppressed if there are no
holdings. There is no check on the correctness of the indicated gating
piece at all now, in that case. But presence of the suffix is still
necessary to trigger the gating of the piece that should be gated.

4 years agoClear highlights and targets when accepting setup command
H.G.Muller [Wed, 1 Jan 2020 19:10:07 +0000]
Clear highlights and targets when accepting setup command

Any form of highlighting should no longer apply when the engine orders
a new position, and the next click will be selection of a piece to move.

4 years agoFix gating at Rook on castling in holdingless seirawan
H.G.Muller [Wed, 1 Jan 2020 19:05:08 +0000]
Fix gating at Rook on castling in holdingless seirawan

Castling must gate what is under the Rook if there is nothing under
the King. ApplyMove() must know this when it gets a move with gating
suffix, while UserMoveEvent() should be smart enough to add that suffix
when the user castles.

4 years agoPrevent gating candidates from moving in holdingless seirawan
H.G.Muller [Wed, 1 Jan 2020 19:00:32 +0000]
Prevent gating candidates from moving in holdingless seirawan

The move generator now ignores pieces on the extreme ranks when
these are used as holdings.

4 years agoFix promotions in holdingless seirawan
H.G.Muller [Wed, 1 Jan 2020 18:56:28 +0000]
Fix promotions in holdingless seirawan

When the extreme ranks are really holdings, promotion should take place on
the penultimate ranks. So a zone width of 2 is now specified in that case.

4 years agoImplement auto-gating in holdingless S-Chess
H.G.Muller [Sun, 15 Dec 2019 22:52:43 +0000]
Implement auto-gating in holdingless S-Chess

When there are no holdings in (parent) variant seirawan, the first and
last rank are supposed to act as file-specific holdings, and pieces
on it will automatically be gated if the virgin piece standing before
them is moved away by the user. (Engines must still specify a gating
through the promotion suffix.) The old location of the gated piece
on the holdings rank will then be blacked out (and the unused squares
on the holdings raks should also be black).

4 years agoSupport preludes in human-engine games
H.G.Muller [Sun, 15 Dec 2019 20:59:43 +0000]
Support preludes in human-engine games

In an engine-defined variant the engine can now show several boards at
the start of the game by sending those to the GUI in a 'setup' command,
by letting all non-final 'setup' commands specify the (newly introduced)
parent variant 'prelude'. These board are intended as 'graphical menus',
from which the user can select a piece or square by clicking on it.
The 'lift' command of the highlight protocol can be used to relay such
clicks to the engine, and prompt it for the next 'setup' command.

4 years agoImprove XBetza e.p. system
H.G.Muller [Sun, 15 Dec 2019 11:25:46 +0000]
Improve XBetza e.p. system

The 'n' modifier can now be used on non-final legs of a multi-leg move
to indicate the target square of that leg becomes e.p. square. Pieces
that define an XBetza 'e' move will be able to use that move to e.p. capture
the last-moved piece when that moves goes to the e.p. square. To implement
this a routine was added to test whether this is the case (or whether the
e.p. capable piece used another move to go to the e.p. square).
  The limitation that there can only be more than a single e.p. square
when there is a pair of vertically adjacent ones still applies.

5 years agoMake square-size rounding dependent on fairy pieces (WB)
H.G.Muller [Sat, 6 Jul 2019 14:03:43 +0000]
Make square-size rounding dependent on fairy pieces (WB)

WinBoard 'rounds' the square size to one of the three values for which
images of fairy pieces are built in, in variants that normally would
contain such pieces. But when used as parent of an engine-defined variant
they might actually not contain any fairy pieces at all. This situation
is now recognized for parent variant fairy, and would suppress the rounding
when it occurs.

5 years agoInterpret UCI2WB's invalid pieceToCharTable
H.G.Muller [Sat, 6 Jul 2019 13:52:32 +0000]
Interpret UCI2WB's invalid pieceToCharTable

UCI2WB sends an invalid pieceToCharTable "-" in its setup command for
engine-defined variants. This would keep the pieceToChar assignment
of the parent variant (in UCI2WB's case always 'fairy'). Now this is
replaced by the pieceToCharTable for variant normal, as the UCI engines
that use this feature only support variants with orthodox pieces.

5 years agoPop up error when locking toerny file fails
H.G.Muller [Tue, 18 Jun 2019 15:03:11 +0000]
Pop up error when locking toerny file fails

The WinBoard implementation of flock is made compatible with the Linux
version, returning 0 for success and -1 for fail. ReserveGame now tests
this, and makes us drop out of tournament mode with an error popup when
a failure occurs.

5 years agoFix saving of engine list
H.G.Muller [Tue, 18 Jun 2019 14:27:31 +0000]
Fix saving of engine list

When a separate engine listw as specified it was only saved after altering
engine settings. Not after Edit Engine List or on exit. Now it is saved
after editing, but not on exit. The latter should cause less loss of data
when multiple instances of WinBoard are open.

5 years agoRefrain from killing known protocol adapters
H.G.Muller [Tue, 18 Jun 2019 09:05:10 +0000]
Refrain from killing known protocol adapters

Killing 'engines' that run through an adapter and won't terminate fast
enough for XBoard's taste will always be very detrimental, as it will
kill the adapter, and leaves the actual engine (for which the adapter
was likely waiting) running, preventing the adapter would take action
against it. We will thus always refrain from killing engines when XBoard
knows they are running through an adapter, because it invoked the adapter
itself in response to the -f/sUCI option.

5 years agoAlso do not nice priority of a remote shell
H.G.Muller [Mon, 17 Jun 2019 11:59:04 +0000]
Also do not nice priority of a remote shell

When the engine is really running elsewhere the program used to
communicate it should not have lowered priority.

5 years agoDo not nice nice-aware adapters
H.G.Muller [Mon, 17 Jun 2019 11:55:52 +0000]
Do not nice nice-aware adapters

It is the engine process we want to run at lower priority, not the
adapter it is running through. So if we know the engine is running
through an adapter, because we invoked it ourselves due to -f/sUCI,
and we pass the adapter the value of the -niceEngines option (presumably
for it to set the priority of the engine it forks off by itself),
we refrain from nicing it.

5 years agoApply -niceEngines priority only to engines
H.G.Muller [Mon, 17 Jun 2019 11:49:01 +0000]
Apply -niceEngines priority only to engines

Child processes started to communicate with ICS should run at normal
priority, and the caller of StartChildProcess now determines whether
the CPU priority will be niced, depending on the task of the process.

5 years agoImprove Edit Position usage note
H.G.Muller [Mon, 3 Jun 2019 12:16:34 +0000]
Improve Edit Position usage note

Bullets for clearing the board and stopping multi-drops were added.

5 years agoFix browsing for souns folder in newer GTK
H.G.Muller [Mon, 3 Jun 2019 11:54:53 +0000]
Fix browsing for souns folder in newer GTK

The file chooser would grey out all folders unless the user would first
switch the filter to 'All Files', in newer GTK versions, when choosing
a sounds or piece-image directory. The problem could be traced to the
corresponding Options specifying an empty filter string, rather than
a NULL pointer. The file chooser would be started with this filter
selected, and at some point GTK changed to interpret the empty pattern
as 'nothing' rather than 'everything'. By specifying NULL for the filter
'All files' will be the only option, and automatically selected.

5 years agoPay attention to hint move in walking pobder PV
H.G.Muller [Mon, 3 Jun 2019 09:58:37 +0000]
Pay attention to hint move in walking pobder PV

When requesting to walk the PV of a pondering engine, it would only
work if that engine had printed the ponder move (in parentheses) as
first move of the PV. But the recommended mode in CECP would have
provided the ponder move in a 'Hint:' command, and start the PV after it.
So that the PV would always start with an invalid move (for the other
player). Backing up to the previous position such as would have to be
done when walking an old PV after the engine has moved, does not solve
this; we have to go one position forward rather than backward. Now
we first try to put the hint move before the PV, if the engine supplying
the PV provided the hint, and pondering is on, before we try to back up.

5 years agoFix echoing of ICS commands in ICS/Chat window
H.G.Muller [Sat, 1 Jun 2019 13:58:01 +0000]
Fix echoing of ICS commands in ICS/Chat window

The ICS output pane did not show the commands submitted to the ICS
by typing in the input field. Now it does, but to prevent the password
from being shown this is made dependent on the value of 'remoteEchoOption'.
Which, to this end, had to be made an external variable shared through
backend.h.

5 years agoFinish change in Clear Board
H.G.Muller [Sat, 1 Jun 2019 12:47:59 +0000]
Finish change in Clear Board

Clock clicks in Edit Position mode now first displays a 'palette board',
then clears any non-Kings, then sets up the start position, and finally
restores the position that was erased by the palette board (if that was
different from the start position). This continues cyclically.
  The clearing of non-royals spares the four center squares, which would
have been empty already in an unmodified palette board. This allows a user
that wants to set up a position with very few pieces to first drag those
to the center, before clearing all other non-royals away, and finally
moving what is left to the desired location. That saves him the trouble
of eliminating the unneeded pieces one by one from the pallette board.

6 years agoProvide user interface for promotion drops
H.G.Muller [Sun, 22 Apr 2018 19:20:37 +0000]
Provide user interface for promotion drops

Pressing the Shift key during a drop move will attempt to drop the promoted
version of the piece.

6 years agoImplement auto-promotion
H.G.Muller [Sat, 21 Apr 2018 19:02:52 +0000]
Implement auto-promotion

A piece that in the pieceToCharTable is marked as a promoted version of
some other piece by using a '-' instead of a '^' will now define both
partners as auto-promoting. This means promotion suffixes on SAN moves
for them will be suppressed an ignored, while in protocol moves they will
always be added. It will also be allowed to drop these pieces in promoted
form. The notation for this will use the nickname of the promoted version,
rather than a +X notation.

6 years agopartial Eit Position change
H.G.Muller [Mon, 16 Apr 2018 19:50:18 +0000]
partial Eit Position change

6 years agoAllow clock click for board clear also with piece menu
H.G.Muller [Wed, 28 Feb 2018 16:20:55 +0000]
Allow clock click for board clear also with piece menu

6 years agoImplement Edit Positon multi-dropping
H.G.Muller [Wed, 28 Feb 2018 14:44:41 +0000]
Implement Edit Positon multi-dropping

Right-clicking a piece in Edit Position mode now 'lifts it off the board',
and makes it available for dropping multiple times, by left-clicking
empty squares while no piece is selected (highlighted) for moving.
Left-clicks on occupied squares select the piece for moving as usual,
but this does not erase the memory of the 'lifted' piece types. This way
click-click moves remain possible in between drop events, e.g. to get a
piece out of the way.
 The type of the piece that will be dropped is indicated in the message
field. Right-clicking an empty square (which is an invalid action, as empty
squares cannot be lifted for dropping) pops up a note with an overview of
what can be done in Edit Position mode.
 This is an alternative for sweep selection as a method of dropping pieces
on the board. For now it replaces the piece menu. Multiple drop clicks to
the same square will increment the piece type, so piece types not in the
original position can still be created. It doesn't seem possible to do
anything with a board that is completely empty, though!

6 years agoFix crash by using texture in black square
H.G.Muller [Fri, 9 Feb 2018 16:11:27 +0000]
Fix crash by using texture in black square

When BlankSquare was called with square_color = 2 to black out a square
(as when drawing holdings), it tried to use a non-existent texture bitmap
for this when background textures were on, risking a segfault in Cairo.

6 years agoFix promoting pieces in Shogi
H.G.Muller [Fri, 26 Jan 2018 13:14:30 +0000]
Fix promoting pieces in Shogi

Because of a bug in a boolean expression the Gold had become a promoting
piece. The promotion procedure on user moves is now only triggered if
the piece itself was not defined as promoted, AND its partner is defined
as promoted.

6 years agoFix Edit Position with engine-defined variant
H.G.Muller [Fri, 26 Jan 2018 13:01:19 +0000]
Fix Edit Position with engine-defined variant

Submitting a new position starts a new game, but the position would be
set up before the engine had the time to reply to the 'variant' command
wit a 'setup'. As a consequence WinBoard would be unaware of the correct
starting position, with as a consequence that Pawns might not be considered
virgin for their Betza 'i' moves.
 Now even late reception of a 'setup' command from the engine when
startedFromSetupPosition is true will cause initialPosition to be
initialized. The assumption is that XBoard was already switched to the
variant before, so that the 'setup' command is not needed for defining the
pieceToCharTable used to interpret the FEN that set up the position.

6 years agoFix Seirawan gating at Rook square in PGN castling moves
H.G.Muller [Wed, 8 Nov 2017 10:30:05 +0000]
Fix Seirawan gating at Rook square in PGN castling moves

The 'reverse gatings' were written as RxK also in PGN, which was ugly.
Now a file disambiguator behind the ID of the gated piece is used for
all castling gatings (also those at the King square). On input omission
of the disambiguator defaults to King square.

6 years agoFix RxK castling from engine in variant seirawan
H.G.Muller [Tue, 7 Nov 2017 20:53:01 +0000]
Fix RxK castling from engine in variant seirawan

The RxK notation for castling with gating at the Rook square was mistaken
for a non-compliant castling notation in games without Fischer castling,
and corrected to the compliant notation by adjusting the to-square, assumed
to be the Rook. But this backfired for RxK, where it is the King. Now
castlings with the to-square on the central file are exempted from this
correction.

6 years agoAdd option -defaultInstallProtocol
H.G.Muller [Thu, 2 Nov 2017 11:43:23 +0000]
Add option -defaultInstallProtocol

A persistent option is added to determine the initial setting of the
protocol-selector combobox in the Load Engine dialog. It must be given
a value 0-4 corresponding to the choice order. This is mainly intended
for configuring Shogi or Xiangqi packages, to select USI or USI (for which
auto-detection does not work).

6 years agoAdd option -defaultEngineInstallDir (XB)
H.G.Muller [Thu, 2 Nov 2017 11:25:10 +0000]
Add option -defaultEngineInstallDir (XB)

A new option is added to configure what appears in the Directory text
entry of the Load Engine dialog when you pop that up. It is volatile,
and intended for use in the masted config file, to set what is convenient
for Linux or OS X.

6 years agoPay attention to dont-add-to-list checkbox again
H.G.Muller [Thu, 2 Nov 2017 11:14:13 +0000]
Pay attention to dont-add-to-list checkbox again

Although it is questionable whether this checkbox will remain in the log
run, as long as it is there we better obey it.

6 years agoFix installing chosen protocols
H.G.Muller [Mon, 30 Oct 2017 22:00:42 +0000]
Fix installing chosen protocols

6 years agoRedesign XBoard Load Engine dialog
H.G.Muller [Mon, 30 Oct 2017 21:56:15 +0000]
Redesign XBoard Load Engine dialog

The XBoard Load Engine dialog now also uses a combobox for protocol
selection, and the order of the controls is changes, with some extra
explanatory text.

6 years agoFix installing with chosen protocol
H.G.Muller [Mon, 30 Oct 2017 21:54:12 +0000]
Fix installing with chosen protocol

The tryNr variable should be set by the Load Engine dialog even when
there is no auto-detection, to make the engine be added to the list.

6 years agoFix chosen WB v1 install
H.G.Muller [Mon, 30 Oct 2017 21:24:30 +0000]
Fix chosen WB v1 install

The autodetect patch had made it impossible to force an engine to be
installed as WB v1, because the v1 flag set by the dialog was overwritten.

6 years agoRedesign WinBoard Load Engine dialog
H.G.Muller [Mon, 30 Oct 2017 17:11:24 +0000]
Redesign WinBoard Load Engine dialog

The checkboxes for protocol choice are replaced by a combobox, which
also contains an autodetect option. This is encoded through the kludge
of setting isUCI = 3.
 The fields that do not usually have to be specified are now put in
group boxes, which make it more clear the user can ignore them.
For this a ew control type GroupBox had to be defined, and supported
in the GenericPopup.

6 years agoAlso update engine list when saving engine settings
H.G.Muller [Sun, 29 Oct 2017 21:20:48 +0000]
Also update engine list when saving engine settings

The 'Make Persistent' button in the Engine Settings dialog will now
also cause the -engineList file to be read before being processed,
and be written back after it, to keep the list up to date for all
open XBoard instances. There still is a problem here, that when another
instance has changed settings of the currently loaded engine, this engine
is no longerrecognized as being in the list. But at least the user will
be warned in such a case that makig the settings change persistent has
failed.

6 years agoImplement separate engine list for WinBoard
H.G.Muller [Sun, 29 Oct 2017 19:54:37 +0000]
Implement separate engine list for WinBoard

Reading the engine list before popping up Edit Engine List and Load Engine
is now also done in WinBoard.

6 years agoLocate engine list in separate file
H.G.Muller [Sun, 29 Oct 2017 19:34:37 +0000]
Locate engine list in separate file

The option -firstChessProgramNames, which contains the list of registered
engines, can now be kept in a dedicated settings file. This file will
be read at startup after the normal settings file and command-line
arguments. It will also be read and saved when dialogs altering the
engine list are used (Load Engine and Edit Engine List). This will
effectively cause changes in the engine list made by any XBoard instance
to be instantly broadcasted to all other instances. The name of this
engine-list file can be specified by the new persistent option -engineList.
If this is set to an empty string (the default), this new feature will
not be used, and the list in the normal settings file will be used
as always. This list is currently still written in the user settings file,
together with the other settings.

6 years agoDecrease feature timeout to 1 sec
H.G.Muller [Sun, 29 Oct 2017 15:02:35 +0000]
Decrease feature timeout to 1 sec

The feature timeout used to be 10 sec, which seems ridiculously long
at present-day computer speeds. It is reduced to 1 sec, but actually
twice this will be used because of the "uci" probe that will follow the
"protover 2" probe, and will use the same timeout.

6 years agoImplement (unconditional) protocol auto-detection
H.G.Muller [Sun, 29 Oct 2017 14:56:10 +0000]
Implement (unconditional) protocol auto-detection

By sending "uci" to the engine after the feature timeout expires,
and redoing the engine replacement with UCI ticked when "uciok" is
received, UCI engines will install properly even when they are first
assumed to be CECP engines. An extra timeout period is taken to wait
for the possible "uciok" response. If this expires too, the engine is
assumed to be WB v1.
  Adding the engine to the engine list had to be deferred until the
protocol is known. This means the "-protocolVersion 1" option can now
also automatically added to the engine line for v1 engines.

7 years agoDo not accept engine 50-move claims in Makruk
H.G.Muller [Wed, 22 Feb 2017 19:53:32 +0000]
Do not accept engine 50-move claims in Makruk

Normally draw claims are always accepted after 100 reversible ply, even
when -ruleMoves is set different from 50. In Makruk this would allow
engines to cheat, as there is in general no 50-move limitation there.
Now the claims are considered false (but adjudication can still be
configured).

7 years agoImplement Makruk counting rules
H.G.Muller [Wed, 22 Feb 2017 19:34:36 +0000]
Implement Makruk counting rules

Adjudication is now performed based on the Makruk counting rules, assuming
the players count in the way most favorable for them. This means that when
the maximum count is N, the game is adjudicated draw immediately after the
Nth move since the counting could have started when the opponent is bared,
but only on the next move when not, to give him the opportunity to checkmate
when he was not counting. This adjudication is switched off if -ruleMoves
is set to a negative value, (normally this would be 0 in Makruk), and is
also dependent on legality testing being on.

7 years agoRemove castling rights from Suicide start position
H.G.Muller [Wed, 1 Feb 2017 12:15:25 +0000]
Remove castling rights from Suicide start position

Suicide was initialized with castling rights, while the move generator
in fact would suppress any castling. The fake rights would appear in FENs,
and break probing of the GUI book.

7 years agoFix e.p. capture in ICS play
H.G.Muller [Tue, 17 Jan 2017 17:53:27 +0000]
Fix e.p. capture in ICS play

The new e.p. rights were not set when the position was obtained
by parsing an ICS board, rather than from applying a move to a previous
position.

7 years agoLet repeated right-clicking upgrade placed piece in Edit Position mode
H.G.Muller [Fri, 13 Jan 2017 13:51:33 +0000]
Let repeated right-clicking upgrade placed piece in Edit Position mode

Right-clicking a square multiple timesin Edit Position mode will now make
it cycle through all pieces defined in the pieceToCharTable.
  When -monoMouse is set a click on an occupied square is interpreted as
a left-click. But an exception is now made for the piece that was just
placed: this will be treated as a right-click, so that this feature is
also accessible in monoMouse mode.

7 years agoFix usage of memory after free in -replace option
H.G.Muller [Fri, 13 Jan 2017 12:26:44 +0000]
Fix usage of memory after free in -replace option

The code for implementing the -replace option was using a string after
its memory was freed, which might not work in all allocation systems.

7 years agoAllow Make Persistent on engine loaded from recent-engine menu
H.G.Muller [Fri, 13 Jan 2017 12:22:27 +0000]
Allow Make Persistent on engine loaded from recent-engine menu

This method of loading an engine from the list was not yet recorded
in the currentEngine[] array.

7 years agoUse feature timeout when starting second engine for analysis
H.G.Muller [Thu, 5 Jan 2017 21:30:41 +0000]
Use feature timeout when starting second engine for analysis

When the second engine gets ivolved in the analysis, but has not been
used before, so that its features are unknown, we now wait for these
features (or time out in case of v1 engines) before initializing the
engine. Without this 'edit' could be used on engines that need 'setboard',
or false 'unsupported variant' errors could arise.

7 years agoFix awareness of settings changed by -firstOption
H.G.Muller [Thu, 5 Jan 2017 16:05:22 +0000]
Fix awareness of settings changed by -firstOption

Options of the type -file and -path that were set through -firstOptions
would not get their 'current value' updated, so that XBoard would not
set them properly on a reload because of reuse=0. In addition the default
value for all option types would be remembered as the value specified
by -firstOptions, rather than the engine default, possibly preventing
their saving on Make Persistent.

7 years agoFix ICS Crazyhouse play
H.G.Muller [Wed, 4 Jan 2017 19:40:08 +0000]
Fix ICS Crazyhouse play

The new way to associate promoted partners to pieces had woken up a latent
bug in the code that determined whether pieces in the ICS board are promoted
Pawns. This led to Pawns appearing out of nowhere on squares evacuated by
white Pawns.

7 years agoMake holdings scrollable
H.G.Muller [Sun, 25 Dec 2016 16:20:30 +0000]
Make holdings scrollable

When the hand size exceeds the number of board ranks R, the holdings will
either display either the first R-1 or last R-1 piece types. The remaining
square will then act as a toggle button between the two states. If there
is indeed material that is not displayed, the toggle square will display
a Prince of the opposite color. (The idea is that themes for games needing
this feature would define this piece as a vertical arrow glyph.)

7 years agoCorrect promotion zone for blacked-out ranks
H.G.Muller [Thu, 22 Dec 2016 20:22:28 +0000]
Correct promotion zone for blacked-out ranks

When the window height has to be larger than the board height, to accomodate
the holdings (as in Wa Shogi), this is done by defining the board height as
large as the holdings size, and blacking out the extra ranks. But when the
depth is calculated as 1/3 of the board height, it should use the real
board height, not the artificially enlarged one.

7 years agoDecouple board height from hand size
H.G.Muller [Thu, 22 Dec 2016 19:28:47 +0000]
Decouple board height from hand size

To make it possible to have holdings larger than the height of the board
window, (of which a selectable subset ca then be displayed), the holdings
size is now referred to a separate variable.

7 years agoGeneralize FEN e.p. field to handle diagonal and triple pushes
H.G.Muller [Tue, 6 Dec 2016 16:19:00 +0000]
Generalize FEN e.p. field to handle diagonal and triple pushes

In Berolina Chess a single square canot unambiguously indicate which
e.p. capture ispossible, as two initial double-pushes could cross over
the same square (and a 4th-rank Pawn could have come from two 2nd-rank
locations). So both the skipped square and the location of the corresponding
e.p.victim have to be mentioned in the e.p. field of a FEN. This is now
supported (in variant Berolina) on both reading and writing.
  In addition, the test for when an e.p. field has to be added is improved.
It was still using hard-coded rank numbers, only acting on 2->4 and 7->5
Pawn moves that stayed on the same file. Now it works on any advance of
more than one rank. For pushes of more than one rank the e.p. square is
biased towards the from-square. This makes it possible to distinguish
between a triple and a double-push that end on the same rank.

7 years agoFix recognition of variant seirawan in examined ICS games
H.G.Muller [Tue, 6 Dec 2016 11:46:07 +0000]
Fix recognition of variant seirawan in examined ICS games

The heuristic for guessing the variant when receiving an ICS holdings
command assumed Crazyhouse when the board width was 8, which prevented
correct interpretation of the holdings content. Now presence of H or E
in the holdings alter the guess to Seirawan Chess.

7 years agoImplement check-count field in FENs
H.G.Muller [Mon, 5 Dec 2016 12:22:40 +0000]
Implement check-count field in FENs

A field of the form N+M between e.p. field and ply counter is now associated
with the CHECK_COUNT game state on reading and writing. It is only written
when non-zero (which again should only happen in 3check). In addition a field
of the form +N+M after the full-move number is recognized on reading as the
SCIDB check counter, which indicates checks given.