Reference · SVG boards and notation
drawSugorokufunction
The board as SVG text for position. The variant says how the sides' points
line up; pass the same one the game is played with.
Import it
import { drawSugoroku } from "@johnmorrisdotca/sugoroku/draw";
Definition
function drawSugoroku(position: Position, options?: SugorokuDrawOptions): string
Parameters
| Name | Type | Description |
|---|---|---|
position | Position | The native checker counts, bar, reserve and borne-off counts. |
options (optional) | SugorokuDrawOptions | Native drawing, geometry, mounting or computer choices specified by the signature. |
Returns
string
The board as SVG text for position. The variant says how the sides' points line up; pass the same one the game is played with.
Examples
import { settingsFor, startPosition } from "@johnmorrisdotca/sugoroku";
import { drawSugoroku } from "@johnmorrisdotca/sugoroku/draw";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(drawSugoroku(position,{variant:"backgammon",label:"Starting board"}).startsWith("<svg"));trueWhat it prints (run when this page was built)