本文へ移動

Sugoroku双六

標準の規則、キューブ、試合の得点、シード付きのサイコロ、再生できる記録で、バックギャモンと仲間のゲームを遊べます。

「双六」は、盤と駒で遊ぶゲームの名前です。 名前について(英語)

目次

リファレンス

規則・ゲーム・記録

import { … } from "@johnmorrisdotca/sugoroku";

最小化と gzip 圧縮をしたサイズは 11.6 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Pure backgammon and variant rules, legal turns, cube and match scoring, dice, records and computer choices.

エクスポート

名前種類概要
agreeDraw関数The game drawn by agreement.
allHome関数Whether every checker of side still in play is in its home board (own points 1 to 6): the condition for bearing off.
applyMove関数The position after a move.
BAR定数The number a move's from has when a checker comes from the bar (or from off the board at the start of a race).
beaverDouble関数Beaver: the side that was doubled redoubles and keeps the cube; the side that doubled must now take it or drop it.
boardPoint関数The point on the board, 1 to 24 counting the way white counts, that is side's own point own.
canBeaver関数Whether the side that was doubled may beaver: redouble at once and keep the cube.
canDouble関数Whether the side on turn may offer a double now.
canPlayAll関数Whether every die of need (highest first) can be played from position, in some order.
chanceOfWinning関数The 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).
checkersOf関数The whole count of each side's checkers: on the board, on the bar, yet to enter, and off.
choosePlay関数The play the computer makes for the rest of the turn of the side on turn, from the plays the rules leave it.
computerAction関数What the side that has to act in a game would do, if the computer were playing it.
ComputerAction型What the computer does next in a game, for the side it plays.
ComputerOptions型Strength, tie-breaking randomness, lookahead time budget and evaluation weights for computer decisions.
concede関数Give up the game: side loses.
concedeKind関数What 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.
countAt関数How many of side's checkers stand on its own point own (1 to 24).
Cube型The doubling cube: what it shows, and who may turn it (null while it stands in the middle, for either).
CUBE_LIMIT定数The most the cube can show.
cubeInPlay関数Whether the cube is in play in a game of a match, given whether this is the Crawford game.
cubeIsDead関数The cube is dead when turning it could not matter: it already shows enough for either side to win the match with a win.
DEFAULT_RULES定数The rules a variant is played with when nothing else is asked: a single game with no cube and no gammons.
diceMustPlay関数WHICH DICE MUST BE PLAYED.
DiceSource型Where dice come from: each call is the number on one die, 1 to 6.
diceToPlay関数The dice a roll gives to play, highest first: a double of a game that plays doubles four times is four of them.
Direction型How the sides' tracks lie on the board.
dropDouble関数Drop 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.
endTurn関数End the side on turn's turn, once everything it had to play has been played.
evaluate関数The score of a position for side, with the other side to move, as a game where bearing off first wins.
evaluateFor関数The score as side plays to win or to lose: a game played to lose is judged the other way up.
EVALUATION_WEIGHTS定数The 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.
EvaluationWeights型The numbers the evaluation is made of, each a number of pips.
finishGame関数The match after a game's result: the score added up, the Crawford game accounted for, and the match over if it is decided.
formatMove関数One move as text: 24/18, bar/22*, 6/off.
formatOpening関数One line of a game: the opening throw.
formatPlay関数The text of a whole turn: moves of one checker joined, equal moves counted, the farthest-back checker first.
formatPosition関数A 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.
formatRecordHeader関数The header lines of a record: its version, the variant, the rules and the seed.
formatResult関数The line that closes a game, with what it came to.
formatTurn関数One line of a game: a turn, with its dice and its play.
GameRecorderクラスA record written as a game is played.
GameResult型The decided winner, ending, win kind, cube multiplier and points.
GameState型The immutable game phase, board, dice, remaining moves, cube and optional result.
Goal型What it takes to win.
hashSeed関数A 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.
Hop型A step of a written play: one checker, one die's distance (or off), as written.
HowItEnded型How a game came to its end.
inContact関数Whether the two sides can still hit one another.
inPlay関数Every checker of side that is still in the game: on the board, on the bar or yet to enter.
isVariantKey関数Whether key names a variant.
keithCount関数The 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).
legalMoves関数The moves the side on turn may make next.
legalPlays関数Every 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.
legalPlaysOf関数Every 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.
Match型A MATCH: games played one after another to a number of points, or without end in money play.
mirrorPoint関数The other side's own number for the point that is side's own point own.
Move型ONE 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).
movesOfDie関数Every move of one die that side may make from position, one for each point a checker can start from.
multiplierOf関数What 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.
newGame関数A new game, waiting for the opening throw.
NewGameOptions型Options for a new game.
newMatch関数A match at 0 to 0.
nextMoves関数The 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.
offerDouble関数Offer a double: the other side must now take it or drop it.
onBoard関数How many checkers side has on the board's points, not counting the bar, the reserve and those borne off.
Opening型How a game is opened.
openingFrom関数An opening throw from a source: one die for white and one for black.
opponentAt関数How many of the other side's checkers stand on the point that is side's own point own.
otherSide関数The other side.
parseHops関数The hops a written play names, in the order written: a chain of three points is two hops, and 13/11(2) is two.
parsePlay関数The moves a written play makes with a roll, or null if it is not a legal play of that roll.
parsePosition関数The position that text of formatPosition's kind stands for, or null if it is not one.
Phase型Where a game has got to.
pipCount関数The pip count of a side: the sum of every checker's distance from being borne off.
Play型A WHOLE TURN: the moves a side makes with a roll, in the order it makes them, and the position they leave.
playMove関数Make one move for the side on turn, given as the checker's own point it leaves and the one it goes to.
playMoves関数The position after a list of moves, made one after another.
playTurn関数Make a whole play (the moves of legalPlays) for the side on turn and end the turn.
POINTS定数The points on the board.
pointsToGo関数How many points a side still needs to win the match: 0 in money play, where there is no such thing.
Position型WHERE THE CHECKERS ARE.
positionFromId関数The position an ID stands for, with onRoll to move, or null if the text is not an ID.
positionId関数The ID of a position with onRoll to move, or null if it cannot be written in this form.
positionKey関数A position as a short string that is the same for the same position, for keeping a set of them.
Preset型A NAMED WAY OF PLAYING: a variant with its rules.
presetByKey関数The preset with this key, or undefined.
presetByName関数The preset a site's printed name leads to, or undefined.
PRESETS定数Every named way of playing, in the order of docs/VARIANTS.md.
Random型A source of random numbers from 0 up to but not including 1.
randomDice関数Dice that are not seeded: from the device's own random numbers.
RECORD_VERSION定数The record format's version, the number after sugoroku on the first line.
RecordSeed型A seed in a record: all digits means a number, anything else is text.
ReplayedGame型One game of a replayed record, finished.
ReplayError型A refused record with its one-based line number and reason.
ReplayOk型A successfully validated record, its settings, completed games and optional current game.
replayRecord関数Replay a record against the rules.
resolveRules関数The rules with anything left out filled from DEFAULT_RULES.
restartTurn関数Take back every move of the turn.
rollDice関数Roll the dice for the side on turn, which must not be waiting on an answer to a double.
rollFrom関数A roll of count dice from a source.
rollOpening関数The opening throw: one die for white and one for black.
Rules型HOW A GAME IS SCORED AND STAKED, beside the variant's board.
rulesProblems関数What goes wrong with a set of rules, as sentences; empty when they are fine.
seededDice関数A 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.
seededRandom関数The mulberry32 stream: the same seed makes the same numbers everywhere.
Settings型The settings of a game: the variant's row and the rules.
settingsFor関数Settings from a variant key (or a row) and rules, left-out rules filled in.
Side型THE TWO SIDES.
sideIndex関数0 for white and 1 for black: where a side's counts are kept in a position.
SIDES定数Both sides, white first.
sideToAct関数Whether 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.
startCounts関数Which points a side's checkers start on, as an array indexed by own point 1 to 24 (index 0 is point 1).
startGame関数The first game, or the next game, of a match.
startPosition関数The position a variant starts from.
startReserve関数How many checkers each side begins off the board, to be entered with the dice.
stepComputer関数Carry out one step of what the computer would do, with dice from dice.
Strength型THE COMPUTER PLAYER, in four strengths.
STRENGTHS定数The strengths, weakest first.
takeDouble関数Take the double that was offered.
turnIsPlayed関数Whether the turn is played out and the side on turn has only to end it.
undoMove関数Take back the last move made this turn.
VARIANT_KEYS定数The variants' keys, in the order the demo lists them.
VariantKey型THE VARIANTS, AS ROWS OF SETTINGS.
VARIANTS定数Every variant.
variantSpec関数The row for a variant.
VariantSpec型A native variant’s checker counts, starting layout, dice, directions, opening and winning goal.
VERSION定数The package's version.
wantsToDouble関数Whether the computer, to move before it rolls, should offer a double.
wantsToTake関数Whether the computer, doubled, should take.
winChance関数A 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.
winKind関数The 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.
WinKind型What kind of win it was, which is how many times the cube's value it scores.
withCounts関数A copy of a position with some counts changed.

ソースを見るGitHub で編集@johnmorrisdotca/sugoroku 1.1.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。