discCountfunction
Count black and white discs currently on a board.
Import it
import { discCount } from "@johnmorrisdotca/narabe";
Definition
function discCount(board: Cell[]): Record<Stone, number>
Parameters
| Name | Type | Description |
|---|---|---|
board | Cell[] | The row-major board cells; null marks an empty point. |
Returns
Record<Stone, number>
Count black and white discs currently on a board.
Examples
import { createGame, discCount } from "@johnmorrisdotca/narabe";
const reversi = createGame({variant:"reversi"});
console.log(discCount(reversi.board));{ black: 2, white: 2 }What it prints (run when this page was built)