boardSvgfunction
The position as one <svg> element, drawn the way its game is traditionally drawn.
Import it
import { boardSvg } from "@johnmorrisdotca/narabe/draw";
Definition
function boardSvg(state: GameState, options?: DrawBoardOptions): string
Parameters
| Name | Type | Description |
|---|---|---|
state | GameState | The current immutable game position. |
options (optional) | DrawBoardOptions | SVG size, label and highlighting options. |
Returns
string
One standalone SVG string representing the position.
Examples
import { createGame } from "@johnmorrisdotca/narabe";
import { boardSvg } from "@johnmorrisdotca/narabe/draw";
const state = createGame({variant:"freestyle",size:15});
console.log(boardSvg(state, { legal: true }).startsWith("<svg"));trueWhat it prints (run when this page was built)