[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]  


Controlling Dice Rolls

roll
This is the basic command used to roll the dice before each turn. It will use the current random number generator to produce a dice roll, and then allow the player to move (if there is at least one legal play for the dice rolled). By rolling the dice, the player gives up any opportunity to double this turn.
set automatic roll value
When the cube is not being used, or is owned by the opponent, or at certain scores in a match, it is either illegal or pointless for a player to double. Under these circumstances, the player might as well roll the dice immediately -- the set automatic roll command instructs @gnubg{} to go ahead and roll the dice without waiting for the player to issue roll, whenever no doubling decision is necessary. The standard toggle commands may be used to turn this option on and off.
set dice pips pips
To set the dice to a particular roll (whether they have already been rolled or not), use the set dice command. The player can then play a move according to the dice specified. Like the roll command, this will also forego any opportunity to double; to disregard a dice roll and allow the player to roll again (or double, if permitted), use set turn player.
set rng generator [seed]
show rng
@gnubg{} allows a variety of methods for generating dice rolls, including several built-in pseudo-random number generators and a facility for external libraries to be used. It is also possible to enter a roll manually whenever required. The set rng command is used to select which generator will be used. The generator parameter must be one of the following:
ansi
The ANSI C standard rand() random number generator. The behaviour of this generator will depend on the C library linked with @gnubg{}, but is typically a linear congruential pseudo-random number generator. Such generators have fairly weak distribution properties, but are generally adequate for producing backgammon dice. However, the ANSI generator is not recommended for performing rollouts, because any small biases in the dice could accumulate over hundreds or thousands of trials and distort the results. Using a better generator would be safer for rollouts.
bsd
The 4.3BSD random() non-linear additive feedback random number generator. This is a good quality generator, but is not available on all systems. @gnubg{} will report an error if you attempt to use this generator if the C library used in your installation does not include the BSD random code.
isaac
Bob Jenkins' ISAAC random number generator. This is believed to be a high quality generator.
manual
By setting the generator to manual, @gnubg{} will not generate the dice itself; rather, it will prompt for a roll to be entered whenever one is required.
md5
MD5 is a public domain message digest algorithm invented by Ron Rivest and documented in RFC 1321. @gnubg{} can use MD5 as a procedure for generating dice rolls -- this generator has the property that the seed increments by one each roll, and so the sequence generated by seed `n+1' will be identical to that generated by seed `n', with the first roll omitted. The command show seed is available when using the md5 generator, for obtaining the current seed value.
mersenne
Choosing this option will enable the Mersenne Twister generator designed by Matsumoto and Nishimura. This should be an excellent pseudo-random number generator.
user
Use the user generator to dynamically load a user library which will be used to produce the dice rolls. See the file `userrng.c' in the @gnubg{} distribution for an example user generator, and instructions on how to write your own.
FIXME explain optional seed parameter
set seed seed
You can change the random number generator seed at any time with the set seed command. FIXME
show seed
FIXME


[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]