Documentation
¶
Overview ¶
Package games defines what a game is and how games are found. It holds types only: the concrete games live in sub-packages, and internal/games/catalog wires them into a Registry (a game package imports this one, so this one cannot import them).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("no such game")
ErrNotFound is returned by Resolve when nothing matches.
Functions ¶
This section is empty.
Types ¶
type AmbiguousError ¶
AmbiguousError is returned by Resolve when a prefix matches several games.
func (*AmbiguousError) Error ¶
func (e *AmbiguousError) Error() string
type Info ¶
type Info struct {
Number int // position on LIST GAMES, 1..n; 0 when not Listed
Listed bool // shown by LIST GAMES (tic-tac-toe is not, as in the film)
Name string // the film's spelling, upper case
Slug string // lower-case words joined by '-'
Aliases []string
Layout proto.Layout
PanelRows int // rows of View for LayoutPanel
Status Status
Blurb string // one line for --games and the README
// Internal marks a program that games hand off to and players never choose: the
// ending. Only Get finds it; Resolve, Exact, All and Listed skip it.
Internal bool
}
Info describes a game. The registry is the only source of it.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the ordered, validated set of games.
func NewRegistry ¶
NewRegistry validates entries and returns a registry in the given order.
func (*Registry) Exact ¶
Exact finds a game whose slug, alias or name equals input after normalisation. Unlike Resolve it never matches numbers or prefixes, so conversation cannot start a game by accident.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ai is the game-tree search WOPR plays board games with: negamax with alpha-beta pruning, iterative deepening, and an optional quiescence search.
|
Package ai is the game-tree search WOPR plays board games with: negamax with alpha-beta pruning, iterative deepening, and an optional quiescence search. |
|
Package airtoground is Air-to-Ground Actions: a short air campaign against WOPR's defended targets (docs/PLAN.md §6.3, a bespoke game on the sim engine's combat-results and kill-ratio tables).
|
Package airtoground is Air-to-Ground Actions: a short air campaign against WOPR's defended targets (docs/PLAN.md §6.3, a bespoke game on the sim engine's combat-results and kill-ratio tables). |
|
Package biotoxic is Theaterwide Biotoxic and Chemical Warfare on the sim engine.
|
Package biotoxic is Theaterwide Biotoxic and Chemical Warfare on the sim engine. |
|
Package blackjack is Black Jack against WOPR's dealer: one deck, the dealer stands on soft 17 (DefaultRules; Rules.StandSoft17 changes it), black jack pays 3 to 2, double down on any first two cards, and one split of a pair a round.
|
Package blackjack is Black Jack against WOPR's dealer: one deck, the dealer stands on soft 17 (DefaultRules; Rules.StandSoft17 changes it), black jack pays 3 to 2, double down on any first two cards, and one split of a pair a round. |
|
Package board draws 8x8 boards for checkers and chess, and parses their squares.
|
Package board draws 8x8 boards for checkers and chess, and parses their squares. |
|
Package bridge is minimal contract bridge (docs/PLAN.md §3, decision 14): WOPR bids all four hands by point count, the player's side always declares (the table turns when East and West hold the cards), and the player plays both declarer's hand and dummy's while WOPR defends.
|
Package bridge is minimal contract bridge (docs/PLAN.md §3, decision 14): WOPR bids all four hands by point count, the player's side always declares (the table turns when East and West hold the cards), and the player plays both declarer's hand and dummy's while WOPR defends. |
|
Package cards is the playing cards the card games share: cards and their text, decks, shuffling with the session's seed, tricks (trick.go), and the cards drawn in ASCII (art.go).
|
Package cards is the playing cards the card games share: cards and their text, decks, shuffling with the session's seed, tricks (trick.go), and the cards drawn in ASCII (art.go). |
|
Package catalog is the one place where game constructors are wired into a registry.
|
Package catalog is the one place where game constructors are wired into a registry. |
|
Package checkers is 8x8 checkers (English draughts) against WOPR: compulsory captures, multiple jumps, kings that move both ways, and a draw after 40 moves each without progress.
|
Package checkers is 8x8 checkers (English draughts) against WOPR: compulsory captures, multiple jumps, kings that move both ways, and a draw after 40 moves each without progress. |
|
Package chess is chess against WOPR.
|
Package chess is chess against WOPR. |
|
Package desertwarfare is Desert Warfare on the sim engine: armour against armour along a coast road, with supply lines.
|
Package desertwarfare is Desert Warfare on the sim engine: armour against armour along a coast road, with supply lines. |
|
Package ending is the film's climax after zero players (docs/PLAN.md §6.2): WOPR plays tic-tac-toe against itself faster and faster while it cracks the last of the launch code, runs every war scenario to WINNER: NONE, and concludes that the only winning move is not to play.
|
Package ending is the film's climax after zero players (docs/PLAN.md §6.2): WOPR plays tic-tac-toe against itself faster and faster while it cracks the last of the launch code, runs every war scenario to WINNER: NONE, and concludes that the only winning move is not to play. |
|
Package falkensmaze is Falken's Maze: a maze under fog of war, walked with the arrow keys.
|
Package falkensmaze is Falken's Maze: a maze under fog of war, walked with the arrow keys. |
|
Package fightercombat is Fighter Combat: a turn-based dogfight of energy and aspect against WOPR (docs/PLAN.md §6.3, a bespoke game on the sim engine's combat-results and kill-ratio tables).
|
Package fightercombat is Fighter Combat: a turn-based dogfight of energy and aspect against WOPR (docs/PLAN.md §6.3, a bespoke game on the sim engine's combat-results and kill-ratio tables). |
|
Package gamestest provides stub programs for tests of the host, persona and ui.
|
Package gamestest provides stub programs for tests of the host, persona and ui. |
|
Package ginrummy is two-player gin rummy against WOPR: ten cards each, draw from the stock or take the discard, then discard; knock with 10 or less deadwood, or go gin with none.
|
Package ginrummy is two-player gin rummy against WOPR: ten cards each, draw from the stock or take the discard, then discard; knock with 10 or less deadwood, or go gin with none. |
|
Package gtw is Global Thermonuclear War, the film's set piece (docs/PLAN.md §6.2): choose a side and list targets; the first strike flies on the big board at once, then you order two more as DEFCON falls, and WOPR takes the last rung alone.
|
Package gtw is Global Thermonuclear War, the film's set piece (docs/PLAN.md §6.2): choose a side and list targets; the first strike flies on the big board at once, then you order two more as DEFCON falls, and WOPR takes the last rung alone. |
|
Package guerrilla is Guerrilla Engagement on the sim engine: an asymmetric campaign.
|
Package guerrilla is Guerrilla Engagement on the sim engine: an asymmetric campaign. |
|
Package hearts is four-handed Hearts: the player sits South and WOPR plays West, North and East.
|
Package hearts is four-handed Hearts: the player sits South and WOPR plays West, North and East. |
|
Package poker is heads-up five-card draw against WOPR: an ante of 1, fixed-limit betting of 5 before the draw and 10 after (a bet and three raises a round), and up to three cards drawn.
|
Package poker is heads-up five-card draw against WOPR: an ante of 1, fixed-limit betting of 5 before the draw and 10 after (a bet and three raises a round), and up to three cards drawn. |
|
Package testkit drives proto programs through the real host runner, with no terminal, and records a transcript: what WOPR printed and what the user typed, as the console would show it.
|
Package testkit drives proto programs through the real host runner, with no terminal, and records a transcript: what WOPR printed and what the user typed, as the console would show it. |
|
Package theaterwide is Theaterwide Tactical Warfare on the sim engine: corps and air wings on a European front, with an escalation ladder.
|
Package theaterwide is Theaterwide Tactical Warfare on the sim engine: corps and air wings on a European front, with an escalation ladder. |
|
Package tictactoe is the game that ends the film: perfect minimax, so nobody can win against WOPR.
|
Package tictactoe is the game that ends the film: perfect minimax, so nobody can win against WOPR. |