Implement feature dice
authorH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 26 May 2020 17:23:45 +0000 (19:23 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 26 May 2020 17:23:45 +0000 (19:23 +0200)
commit1744aede9487e7dab6afec43f64e752d3ef32c44
treef8fb69c2e1ea3f9e975aae89ad47503012475e49
parent476bff81752266229607c83a3fc48a947b0cae40
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).
backend.c
backend.h