LinuxCommandLibrary

backgammon

Play the backgammon board game

SYNOPSIS

backgammon [-p]

PARAMETERS

-p
    Two-player mode: play against another human instead of the computer.

DESCRIPTION

The backgammon command provides a text-based implementation of the ancient board game backgammon for Unix-like systems. It features a curses-driven interface displaying an ASCII-art board, checkers represented by symbols like 'X' and 'O', and a status line for dice rolls, scores, and the doubling cube.

By default, it pits the human player against a computer opponent using minimax search with alpha-beta pruning and heuristics for competent play. Players input moves as sequences of two-digit numbers (e.g., 2415 for two moves), with automatic dice rolling on Enter or r. Special commands handle doubling (d), resigning (x), and more.

Use -p for two-player mode, ideal for head-to-head matches on a single terminal. Games support saving (S) to and loading (L) from files, quitting (QQ or ..), and viewing help (h).

Scoring awards 1 point for normal wins, 2 for gammons, 3 for backgammons, multiplied by cube value. High scores are recorded system-wide. Part of traditional BSD games, it offers nostalgic, strategic fun in any terminal supporting ncurses.

CAVEATS

Requires terminal at least 20x24 characters; smaller windows may corrupt display.
System scores in /var/games/backgammon.scores (permissions needed).
Relies on symbols; not accessible for color-blind users.

KEY IN-GAME COMMANDS

r or Enter: Roll dice.
d: Double cube.
S: Save game.
L: Load game.
h: Help.QQ or ..: Quit.

SCORING RULES

Normal win: 1 pt.
Gammon (opponent bears off none): 2 pts.
Backgammon (opponent has checker on bar or home): 3 pts.
Multiplied by current cube value.

HISTORY

Developed by Alan Baratz at MIT, debuted in early 1980s BSD Unix (4.2BSD onward). Ported to Linux via bsdgames package; remains largely unchanged for decades.

SEE ALSO

Copied to clipboard