checkersHasCapturefunction
Whether any of stone's pieces on the board has a capture available right now.
Import it
import { checkersHasCapture } from "@johnmorrisdotca/narabe";
Definition
function checkersHasCapture(board: Cell[], kings: readonly Point[], size: number, stone: Stone, rules?: CheckersRules): boolean
Parameters
| Name | Type | Description |
|---|---|---|
board | Cell[] | The row-major board cells; null marks an empty point. |
kings | readonly Point[] | The points occupied by crowned pieces. |
size | number | The number of cells on each side of the board. |
stone | Stone | The black or white colour being examined. |
rules (optional) | CheckersRules | The draughts rule set governing capture. |
Returns
boolean
Whether any of stone's pieces on the board has a capture available right now.
Examples
import { ENGLISH_CHECKERS_RULES, checkersHasCapture, createGame } from "@johnmorrisdotca/narabe";
const checkers = createGame({variant:"checkers"});
console.log(checkersHasCapture(checkers.board,checkers.kings,8,"black",ENGLISH_CHECKERS_RULES));falseWhat it prints (run when this page was built)