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


Playing Backgammon with @gnubg

This chapter introduces several more commands used while playing games and matches in @gnubg{}.

Commands Used During the Game

new game
This command is used to start a game within a match or session. (Note that all games are played within matches or sessions; see section Matches and Sessions. To play a single game, use either a 1 point match or a session lasting for one game, depending whether you want gammons and the doubling cube to be active.) new game will set up the board in the starting position, and roll one die for each player for the opening move. If you are in the middle of a game, new game will ask you if you want to abort the game in progress. If you do, a new game will replace the current one (i.e. the partially completed game will have no effect on the score). If you want the current game to be scored for either player, you should use the resign command instead.
move from to ...
move =number
from to ...
=number
The move command allows you to make chequer plays when it is your turn. In its normal form, you should specify pairs of point numbers indicating the points you want to move a chequer from and to. Specify one pair for each chequer you want to move. (For instance, on an opening roll of 31, you might use move 8 5 6 5 to move two chequers -- one from your 8 point to your 5 point, and the other from your 6 point to your 5 point.) For several example moves, see section Sample Game. You should use the words bar and off when moving a chequer from the bar or bearing it off the board, e.g. move bar 20 or move 3 off. These words can be abbreviated to b and o respectively. If there is only one legal move you can make, then the command move by itself will make it for you without requiring you to specify it in full. Similarly, if there is no play available at all, then move will end your turn without moving. As long as you specify at least one pair of points, then the word move is optional -- the command bar 20 24 20 means exactly the same thing as move bar 20 24 20, for instance. FIXME document `=n' notation. If you are using a window system, you can also move chequers using the board window. One way to do this is to use any mouse button to drag a chequer (that is, press the button when the pointer is over the chequer you wish to move; move the pointer to the point you wish to play it to, and then release the button). An alternative is to click a mouse button on the chequer; button 1 will move it by the number of pips showing on the left die, and any other button will move it according to the right die. If you don't like the order the dice are displayed in, pressing either button 2 or 3 on the dice will swap their positions. Whichever method you use to move the chequers, once you have made a legal move you can end your turn by clicking mouse button 1 on the dice. FIXME reference set auto move and set auto bearoff.
resign [type]
agree
accept
decline
reject
The resign command is used to give up a game without playing it to completion. It is often useful during endgame play when the game reaches a position where it is impossible for one player to win. If you do not specify a value type, then the player whose turn it is offers to give up one game (at the current cube value) to the opponent; you can also specify 1, 2 or 3 to resign a single, double or triple game. Specifying normal, gammon or backgammon is also legal, and is identical to expressing the number of points as a digit. single is yet another synonym for one game. The opponent may accept the resignation with either the agree or accept commands, but is not obliged to. To ignore the resignation and continue play normally, use either the decline or reject commands. (accept and reject are also legal commands in response to a double; see section The Doubling Cube.)
set board id|=number
If you wish to directly set the chequers to a different position, you can use the set board command. You need to know the position ID of the chequer arrangement you want; position IDs are always displayed when the board is shown. (If you are playing on a text terminal, the position ID is in the upper right hand corner of the board diagram; when using the board window, the ID is shown below the board on the right hand side.) For instance, to set the chequers to the starting position, use the command set board 4HPwATDgc/ABMA. FIXME reference =n notation and describe the GTK edit mode
show board [id|=number]
The show board command is used to display a particular position --- normally the board of the current game, but it is also possible to view unrelated layouts. When specified without the optional id parameter, the current position is displayed. (When using a text terminal, this is useful if subsequent output has caused the board diagram to scroll off the screen. In the board window, the command can be used to undo erroneous chequer plays by resetting the window to the position at the start of the turn.) When a position ID id is given, the chequers are arranged into the position specified and that board is displayed. Note that this command affects the display only; the current game is unchanged. Use the show board command with no parameter if you want to see the current game again.
hint
At any time during the game when the dice have been rolled, you can use the hint command to see the moves @gnubg{} recommends. The output is of the following form:
Win    W(g)   W(bg)  L(g)   L(bg)  Equity       Move
0.542  0.142  0.008  0.113  0.008  (+0.114)     6/5 8/5 
0.505  0.120  0.008  0.122  0.007  (+0.009)     24/23 23/20 
0.498  0.126  0.008  0.123  0.007  (+0.000)     24/23 13/10 
0.499  0.113  0.008  0.121  0.007  (-0.011)     24/23 24/21 
0.486  0.125  0.008  0.120  0.009  (-0.024)     13/10 10/9 
0.481  0.116  0.008  0.129  0.008  (-0.051)     6/5 24/21 
0.472  0.122  0.008  0.129  0.009  (-0.064)     6/5 13/10 
The moves are listed in descending order of preference, so in this case, @gnubg{} recommends the move `6/5 8/5'. The first five columns are its estimates of the probability of the player on roll winning (`Win'), winning a gammon (`W(g)'), winning a backgammon (`W(bg)'), losing a gammon (`L(g)'), and losing a backgammon (`L(bg)') if the game is played to completion without use of the doubling cube, after the candidate move in that row is made(1). The sixth column, `Equity', is the estimated cubeless equity following the move --- this is the expected number of points per game won by the player on roll. FIXME describe =n notation. @gnubg{} will `look ahead' a certain number of moves when evaluating the probabilities, according to the search depth set by the set plies command (see section Using @gnubg{} to Analyse Positions).
show pipcount [id|=number]
Use show pipcount to automatically count the number of `pips' each player needs to bear off. Depending on the position, the output will look something like:
The pip counts are: X 103, O 112.
show player
set player name human
set player old-name name new-name
Both players have a certain amount of configuration information; use the command show player to summarise these settings. By default, @gnubg{} will play for player 0, whose name is initially `gnubg'. Player 1 defaults to a human (i.e. @gnubg{} will prompt the user for a move when it is player 1's turn) whose name is the user's login name, on systems where this information is available; on single-user systems, the default name `user' applies. Either player can be set to a human with the command set player name human, where name is either the number of the player (0 or 1) or that player's name (initially `gnubg' and `user' or the user's login name). You can also specify both which will set both players simultaneously. There are also options for computer players (see section Having @gnubg{} Make Moves). You can change the names of the players with the set player old-name name new-name command. Again, either the player numbers or names are valid for the old-name parameter. Names may not contain whitespace characters, and may not be longer than 31 characters. The names `0', `1' and `both' are not permitted, to avoid ambiguities, and the players may not both share the same name. Names are not case sensitive.
set turn player
show turn
The command set turn player (where player can be the player's name or number, as above) is used to control which player is on roll. It will cancel the current dice roll and cube action (if any), and set the named player on roll.
set automatic bearoff
set automatic move
FIXME
set display value
By default, @gnubg{} will update the display before and after every move, whether made by a human or automatically. (When using the graphical board, the board window is redrawn to the current position; when using the ASCII board, a new diagram is displayed on the terminal.) Information about cube actions and resignations offered will also appear as appropriate. The command set display off will suppress this output, which can speed up the display and reduce clutter (this might be useful when completing a game where both sides are played by the computer, for instance). set display on will restore the default behaviour. The standard toggle synonyms may be substituted for on and off. The board will always be updated when it is a human player's turn to move, regardless of the display setting.

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

Having @gnubg{} Make Moves

set player name gnubg
This command will instruct @gnubg{} to choose moves (and make cube decisions) for the specified player, using its evaluation engine.
set player name pubeval
An alternative computer player can be chosen by setting a player to pubeval. This will cause moves for that player to be made by Gerry Tesauro's benchmark player. pubeval is much weaker than @gnubg{}'s own evaluator, but provides a constant level of play which is useful for measuring different players against. pubeval is not capable of making cube or resignation decisions based on the position. It will never accept resignations at less than triple (backgammon) stakes, and will take all cubes. It nevers offers resignations or doubles of its own.
set player name external
FIXME
set player name evaluation
FIXME
play
FIXME
external
FIXME

Matches and Sessions

This section describes how to use GNU Backgammon to play series of games, whether those games are part of a match (as in tournament backgammon) or a session of independent games (conventionally called "money" play, regardless of whether any payment is involved).

new match length
new session
set automatic game
set crawford
set postcrawford
set automatic crawford
set jacoby
set automatic doubles limit
set score points points
show crawford
show postcrawford
show jacoby
show score
FIXME

The Doubling Cube

double
redouble
beaver
take
accept
drop
pass
reject
set cube centre
set cube owner player
set cube use
set cube value points
FIXME

Saving Games and Matches

save game file
save match file
load game file
load match file
FIXME


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