Reference · Game engine and table
hitotsuComputerfunction
Choose a move for the current player from the legal choices. Call only while the game is playing.
Import it
import { hitotsuComputer } from "@johnmorrisdotca/hitotsu";
Definition
function hitotsuComputer(game: HitotsuGame): HitotsuMove
Parameters
| Name | Type | Description |
|---|---|---|
game | HitotsuGame | The current native game; it is left unchanged. |
Returns
HitotsuMove
A native legal move for the current player while the game is playing.
Examples
import { HITOTSU_CLASSIC, hitotsuComputer, startHitotsu } from "@johnmorrisdotca/hitotsu";
const game = startHitotsu(1, ["Aki", "Ben"], 42, HITOTSU_CLASSIC, [true, true])!;
console.log(hitotsuComputer(game));{ play: 'YD0' }What it prints (run when this page was built)