Reference · Rules, games and records
parseHopsfunction
The hops a written play names, in the order written: a chain of three points
is two hops, and 13/11(2) is two. Returns null for text that is not a play. -, pass,
and the empty text are the play of no moves.
Import it
import { parseHops } from "@johnmorrisdotca/sugoroku";
Definition
function parseHops(text: string): Hop[] | null
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Native move notation, position text or full record specified by the signature. |
Returns
Hop[] | null
The hops a written play names, in the order written: a chain of three points is two hops, and 13/11(2) is two. Returns null for text that is not a play. -, pass, and the empty text are the play of no moves.
Examples
import { parseHops } from "@johnmorrisdotca/sugoroku";
console.log(parseHops("8/5 6/5"));[ { from: 8, to: 5 }, { from: 6, to: 5 } ]What it prints (run when this page was built)