areaWinnerfunction
The colour whose area plus komi wins the Go position.
Import it
import { areaWinner } from "@johnmorrisdotca/narabe/rules/go";
Definition
function areaWinner(board: Cell[], size: number, komi: number): Stone
Parameters
| Name | Type | Description |
|---|---|---|
board | Cell[] | The row-major board cells; null marks an empty point. |
size | number | The number of cells on each side of the board. |
komi | number | The score bonus credited to white. |
Returns
Stone
Black when its area is greater than white area plus komi; otherwise white.
Examples
import { createGame, playMove } from "@johnmorrisdotca/narabe";
import { areaWinner } from "@johnmorrisdotca/narabe/rules/go";
const go = playMove(createGame({variant:"go",size:9}),{row:4,col:4});
console.log(areaWinner(go.board, go.settings.size, 6.5));blackWhat it prints (run when this page was built)