BoardLayoutclass
The layout of a board, a function of its options: where each point, the bar, each tray, the rail and the dice sit, all in landscape units.
Every export of every entry point, each with its own page. This page keeps the addresses the old one-page reference had.
@johnmorrisdotca/sugoroku/drawBoardLayoutclassThe layout of a board, a function of its options: where each point, the bar, each tray, the rail and the dice sit, all in landscape units.
BoardOptionstypeThe cube, viewing side, home direction and orientation used to calculate board geometry.
boardSizefunctionThe width and height the board is drawn in, which is the other way about when it stands up.
BoxtypeA box: where something is, in landscape units before any turning.
colourPropertyfunctionThe custom property a colour is set on.
colourStylefunctionThe inline custom properties of a drawing: the named board and checkers, then any colour given.
drawSugorokufunctionThe board as SVG text for position.
MOST_DRAWNconstantHow many checkers are drawn on a stack before the last one carries the count.
OrientationtypeWhether the board lies across the page or stands up in it.
SUGOROKU_BOARD_NAMESconstantThe names of the boards.
SUGOROKU_BOARDSconstantThe boards the drawing knows by name, set against any theme.
SUGOROKU_CHECKER_SET_NAMESconstantThe names of the checker sets.
SUGOROKU_CHECKER_SETSconstantThe checkers the drawing knows by name.
SUGOROKU_COLOUR_NAMESconstantThe names of the colours, as the custom properties spell them (--sg- and the name in kebab case).
SUGOROKU_STYLEconstantTHE STYLE a Sugoroku board is drawn with: colours as custom properties (--sg-felt, --sg-white and the rest of SugorokuColours), light by default and dark when the device is, and the one rule that matters for a game played with fingers and a mouse: nothing on the board can be selected, dragged or double-tapped.
SugorokuBoardNametypeA named board, a set of colours for the board and its points.
SugorokuCheckerSetNametypeA named pair of checker colours.
SugorokuColourstypeTHE COLOURS OF A BOARD.
SugorokuDrawOptionstypeWhat to draw with.
@johnmorrisdotca/sugoroku/playcreateSoundsfunctionA player for the sounds, which makes its audio only when first asked to play, as browsers insist on a gesture first.
ensureSugorokuPlayStylefunctionPut the style in the page once: in the document's head, or in the shadow root the host is in.
mountSugorokufunctionMount a board into host.
packagedSoundsfunctionThe sounds' addresses beside the package's code, or an empty set where import.meta.url is not an address (some test runners).
SoundNametypeTHE SOUNDS OF A BOARD, optional: a checker set down, a checker hit, the dice and the cube.
SoundPlayertypeOptional board-sound playback and cleanup methods.
SoundUrlstypeThe address of each sound.
SUGOROKU_PLAY_STYLEconstantTHE STYLE a playable Sugoroku board wears (mountSugoroku, <sugoroku-board>): the drawing's own (SUGOROKU_STYLE), the board's box, its buttons and its lines of words.
SUGOROKU_STRINGSconstantThe native English and Japanese labels, announcements and interpolation templates.
SugorokuEventDetailtypeWhat every event of the board carries.
SugorokuLanguagetypeTHE WORDS A SUGOROKU BOARD SAYS, in English and Japanese: the buttons, the line that says whose turn it is and what to do, and the result of a game.
sugorokuLanguageOffunctionThe language an element or its page is in: its own lang, or the nearest above, and English unless that begins with ja.
SugorokuLooktypeHow the board looks, apart from the game.
SugorokuMounttypeThe mounted native board, current game/match/record, actions and cleanup handle.
SugorokuMountOptionstypeNative variant, rules, seed, computer, display, control, sound and event-callback choices.
sugorokuSayfunctionA line in a language with its {name}s filled in.
@johnmorrisdotca/sugoroku/elementdefineBoardfunctionDefines the default playable board, or a subclass under a custom tag.
definePositionfunctionDefines a static position, or a subclass under a host's tag.
readEmbedPositionfunctionReads a GNU position ID or bounded JSON position; null means invalid counts or input.
SUGOROKU_DRAW_OPTION_KEYSconstantNative draw keys, checked by the shared builder.
SUGOROKU_EMBED_OPTION_KEYSconstantThe real mounted options, checked alongside builder coverage.
SUGOROKU_POSITION_OPTION_KEYSconstantAll host position options, checked by the builder.
SugorokuBoardclassNative custom element with reflected setup and presentation.
SugorokuElementOptionstypeHost mount options, including custom colours, names, a match and callbacks.
SugorokuPositionclassA read-only backgammon position, drawn by the native SVG writer.
SugorokuPositionOptionstypeHost data and all native SVG drawing choices for a position.
@johnmorrisdotca/sugoroku/element/definedefineBoardfunctionDefines the default playable board, or a subclass under a custom tag.
definePositionfunctionDefines a static position, or a subclass under a host's tag.
readEmbedPositionfunctionReads a GNU position ID or bounded JSON position; null means invalid counts or input.
SUGOROKU_DRAW_OPTION_KEYSconstantNative draw keys, checked by the shared builder.
SUGOROKU_EMBED_OPTION_KEYSconstantThe real mounted options, checked alongside builder coverage.
SUGOROKU_POSITION_OPTION_KEYSconstantAll host position options, checked by the builder.
SugorokuBoardclassNative custom element with reflected setup and presentation.
SugorokuElementOptionstypeHost mount options, including custom colours, names, a match and callbacks.
SugorokuPositionclassA read-only backgammon position, drawn by the native SVG writer.
SugorokuPositionOptionstypeHost data and all native SVG drawing choices for a position.
@johnmorrisdotca/sugorokuagreeDrawfunctionThe game drawn by agreement.
allHomefunctionWhether every checker of side still in play is in its home board (own points 1 to 6): the condition for bearing off.
applyMovefunctionThe position after a move.
BARconstantThe number a move's from has when a checker comes from the bar (or from off the board at the start of a race).
beaverDoublefunctionBeaver: the side that was doubled redoubles and keeps the cube; the side that doubled must now take it or drop it.
boardPointfunctionThe point on the board, 1 to 24 counting the way white counts, that is side's own point own.
canBeaverfunctionWhether the side that was doubled may beaver: redouble at once and keep the cube.
canDoublefunctionWhether the side on turn may offer a double now.
canPlayAllfunctionWhether every die of need (highest first) can be played from position, in some order.
chanceOfWinningfunctionThe chance, 0 to 1, that side wins from here, by the evaluation, or by the Keith count's rule of thumb in a race (as 0.5 plus a share of the count's lead).
checkersOffunctionThe whole count of each side's checkers: on the board, on the bar, yet to enter, and off.
choosePlayfunctionThe play the computer makes for the rest of the turn of the side on turn, from the plays the rules leave it.
computerActionfunctionWhat the side that has to act in a game would do, if the computer were playing it.
ComputerActiontypeWhat the computer does next in a game, for the side it plays.
ComputerOptionstypeStrength, tie-breaking randomness, lookahead time budget and evaluation weights for computer decisions.
concedefunctionGive up the game: side loses.
concedeKindfunctionWhat a side gives up if it gives up the game now, which is the worst the position could come to: a single game once it has borne a checker off; a gammon if nothing of the other side's can still hit it; otherwise a backgammon where it may have a checker caught in the other side's home board.
countAtfunctionHow many of side's checkers stand on its own point own (1 to 24).
CubetypeThe doubling cube: what it shows, and who may turn it (null while it stands in the middle, for either).
CUBE_LIMITconstantThe most the cube can show.
cubeInPlayfunctionWhether the cube is in play in a game of a match, given whether this is the Crawford game.
cubeIsDeadfunctionThe cube is dead when turning it could not matter: it already shows enough for either side to win the match with a win.
DEFAULT_RULESconstantThe rules a variant is played with when nothing else is asked: a single game with no cube and no gammons.
diceMustPlayfunctionWHICH DICE MUST BE PLAYED.
DiceSourcetypeWhere dice come from: each call is the number on one die, 1 to 6.
diceToPlayfunctionThe dice a roll gives to play, highest first: a double of a game that plays doubles four times is four of them.
DirectiontypeHow the sides' tracks lie on the board.
dropDoublefunctionDrop the double that was offered: the side that drops it loses the game, at the cube's value before the double, or for a beaver at its value once the double was taken.
endTurnfunctionEnd the side on turn's turn, once everything it had to play has been played.
evaluatefunctionThe score of a position for side, with the other side to move, as a game where bearing off first wins.
evaluateForfunctionThe score as side plays to win or to lose: a game played to lose is judged the other way up.
EVALUATION_WEIGHTSconstantThe weights the computer plays with: set by hand and then held against random changes of themselves, none of which won more often over two thousand games.
EvaluationWeightstypeThe numbers the evaluation is made of, each a number of pips.
finishGamefunctionThe match after a game's result: the score added up, the Crawford game accounted for, and the match over if it is decided.
formatMovefunctionOne move as text: 24/18, bar/22*, 6/off.
formatOpeningfunctionOne line of a game: the opening throw.
formatPlayfunctionThe text of a whole turn: moves of one checker joined, equal moves counted, the farthest-back checker first.
formatPositionfunctionA position as text, for any variant: each side's checkers as point:count in that side's own numbering, highest point first, then the bar, those yet to enter and those borne off, [white, black] each.
formatRecordHeaderfunctionThe header lines of a record: its version, the variant, the rules and the seed.
formatResultfunctionThe line that closes a game, with what it came to.
formatTurnfunctionOne line of a game: a turn, with its dice and its play.
GameRecorderclassA record written as a game is played.
GameResulttypeThe decided winner, ending, win kind, cube multiplier and points.
GameStatetypeThe immutable game phase, board, dice, remaining moves, cube and optional result.
GoaltypeWhat it takes to win.
hashSeedfunctionA whole number from a seed given as a number or as text: the same seed is always the same number, in every browser and every Node.
HoptypeA step of a written play: one checker, one die's distance (or off), as written.
HowItEndedtypeHow a game came to its end.
inContactfunctionWhether the two sides can still hit one another.
inPlayfunctionEvery checker of side that is still in the game: on the board, on the bar or yet to enter.
isVariantKeyfunctionWhether key names a variant.
keithCountfunctionThe Keith count of a side, a pip count corrected for how badly the checkers are placed for bearing off: plus 2 for each checker beyond the first on the 1-point, 1 for each beyond the first on the 2-point and beyond three on the 3-point, and 1 for each empty point among the 4, 5 and 6, and then the side on roll adds a seventh (rounded down).
legalMovesfunctionThe moves the side on turn may make next.
legalPlaysfunctionEvery different turn a side may make with a roll: one for each position that playing the roll as the rules require can leave, with one way of getting there.
legalPlaysOffunctionEvery different way the side on turn may play out the rest of its turn: for the dice it has yet to play, from where the position stands now.
MatchtypeA MATCH: games played one after another to a number of points, or without end in money play.
mirrorPointfunctionThe other side's own number for the point that is side's own point own.
MovetypeONE CHECKER MOVED BY ONE DIE, in the mover's own numbering: from its own point from (or the BAR, 25, for a checker entering from the bar or from off the board at the start of a race) to its own point to (0 for borne off).
movesOfDiefunctionEvery move of one die that side may make from position, one for each point a checker can start from.
multiplierOffunctionWhat a win of kind is worth, after the rules: a single win when gammons do not count, or when the Jacoby rule holds them back because the cube was never turned.
newGamefunctionA new game, waiting for the opening throw.
NewGameOptionstypeOptions for a new game.
newMatchfunctionA match at 0 to 0.
nextMovesfunctionThe moves that may be made next, by a side that still has the dice need (highest first) to play from position: every move that leaves the rest of need playable.
offerDoublefunctionOffer a double: the other side must now take it or drop it.
onBoardfunctionHow many checkers side has on the board's points, not counting the bar, the reserve and those borne off.
OpeningtypeHow a game is opened.
openingFromfunctionAn opening throw from a source: one die for white and one for black.
opponentAtfunctionHow many of the other side's checkers stand on the point that is side's own point own.
otherSidefunctionThe other side.
parseHopsfunctionThe hops a written play names, in the order written: a chain of three points is two hops, and 13/11(2) is two.
parsePlayfunctionThe moves a written play makes with a roll, or null if it is not a legal play of that roll.
parsePositionfunctionThe position that text of formatPosition's kind stands for, or null if it is not one.
PhasetypeWhere a game has got to.
pipCountfunctionThe pip count of a side: the sum of every checker's distance from being borne off.
PlaytypeA WHOLE TURN: the moves a side makes with a roll, in the order it makes them, and the position they leave.
playMovefunctionMake one move for the side on turn, given as the checker's own point it leaves and the one it goes to.
playMovesfunctionThe position after a list of moves, made one after another.
playTurnfunctionMake a whole play (the moves of legalPlays) for the side on turn and end the turn.
POINTSconstantThe points on the board.
pointsToGofunctionHow many points a side still needs to win the match: 0 in money play, where there is no such thing.
PositiontypeWHERE THE CHECKERS ARE.
positionFromIdfunctionThe position an ID stands for, with onRoll to move, or null if the text is not an ID.
positionIdfunctionThe ID of a position with onRoll to move, or null if it cannot be written in this form.
positionKeyfunctionA position as a short string that is the same for the same position, for keeping a set of them.
PresettypeA NAMED WAY OF PLAYING: a variant with its rules.
presetByKeyfunctionThe preset with this key, or undefined.
presetByNamefunctionThe preset a site's printed name leads to, or undefined.
PRESETSconstantEvery named way of playing, in the order of docs/VARIANTS.md.
RandomtypeA source of random numbers from 0 up to but not including 1.
randomDicefunctionDice that are not seeded: from the device's own random numbers.
RECORD_VERSIONconstantThe record format's version, the number after sugoroku on the first line.
RecordSeedtypeA seed in a record: all digits means a number, anything else is text.
ReplayedGametypeOne game of a replayed record, finished.
ReplayErrortypeA refused record with its one-based line number and reason.
ReplayOktypeA successfully validated record, its settings, completed games and optional current game.
replayRecordfunctionReplay a record against the rules.
resolveRulesfunctionThe rules with anything left out filled from DEFAULT_RULES.
restartTurnfunctionTake back every move of the turn.
rollDicefunctionRoll the dice for the side on turn, which must not be waiting on an answer to a double.
rollFromfunctionA roll of count dice from a source.
rollOpeningfunctionThe opening throw: one die for white and one for black.
RulestypeHOW A GAME IS SCORED AND STAKED, beside the variant's board.
rulesProblemsfunctionWhat goes wrong with a set of rules, as sentences; empty when they are fine.
seededDicefunctionA SEEDED DICE SEQUENCE: the same seed is the same dice, one die after another, in every browser and every Node, so a game can be played again from its seed and a server can tell whether the dice a game says it had are the dice it should have had.
seededRandomfunctionThe mulberry32 stream: the same seed makes the same numbers everywhere.
SettingstypeThe settings of a game: the variant's row and the rules.
settingsForfunctionSettings from a variant key (or a row) and rules, left-out rules filled in.
SidetypeTHE TWO SIDES.
sideIndexfunction0 for white and 1 for black: where a side's counts are kept in a position.
SIDESconstantBoth sides, white first.
sideToActfunctionWhether a side is the one the computer would act for at this moment of a game: the side on turn, or the side that must answer a double.
startCountsfunctionWhich points a side's checkers start on, as an array indexed by own point 1 to 24 (index 0 is point 1).
startGamefunctionThe first game, or the next game, of a match.
startPositionfunctionThe position a variant starts from.
startReservefunctionHow many checkers each side begins off the board, to be entered with the dice.
stepComputerfunctionCarry out one step of what the computer would do, with dice from dice.
StrengthtypeTHE COMPUTER PLAYER, in four strengths.
STRENGTHSconstantThe strengths, weakest first.
takeDoublefunctionTake the double that was offered.
turnIsPlayedfunctionWhether the turn is played out and the side on turn has only to end it.
undoMovefunctionTake back the last move made this turn.
VARIANT_KEYSconstantThe variants' keys, in the order the demo lists them.
VariantKeytypeTHE VARIANTS, AS ROWS OF SETTINGS.
VARIANTSconstantEvery variant.
variantSpecfunctionThe row for a variant.
VariantSpectypeA native variant’s checker counts, starting layout, dice, directions, opening and winning goal.
VERSIONconstantThe package's version.
wantsToDoublefunctionWhether the computer, to move before it rolls, should offer a double.
wantsToTakefunctionWhether the computer, doubled, should take.
winChancefunctionA chance of winning, 0 to 1, that a score in pips stands for: the logistic curve, which a lead of 25 pips in a position of this kind takes to about three in four.
winKindfunctionThe kind of win a game that winner has won by bearing off is: single, gammon or backgammon, before the rules say what they count for.
WinKindtypeWhat kind of win it was, which is how many times the cube's value it scores.
withCountsfunctionA copy of a position with some counts changed.