Reference · Game engine and table
hitotsuViewfunction
One seat’s hand and legal choices, with public counts and the current colour, for a computer player.
Import it
import { hitotsuView } from "@johnmorrisdotca/hitotsu";
Definition
function hitotsuView(game: HitotsuGame, seat?: number): HitotsuView
Parameters
| Name | Type | Description |
|---|---|---|
game | HitotsuGame | The current native game; it is left unchanged. |
seat (optional) | number | The zero-based seat whose choices are requested. |
Returns
HitotsuView
One seat’s hand and legal choices, with public counts and the current colour, for a computer player.
Examples
import { HITOTSU_CLASSIC, hitotsuView, startHitotsu } from "@johnmorrisdotca/hitotsu";
const game = startHitotsu(1, ["Aki", "Ben"], 42, HITOTSU_CLASSIC, [true, true])!;
console.log(hitotsuView(game, 0));{
seat: 0,
hand: [
'R31', 'R50',
'YD0', 'G00',
'G61', 'BD0',
'WF2'
],
counts: [ 7, 7 ],
colour: 'Y',
next: 1,
drawn: null,
challengeFrom: null,
legal: [
{ play: 'YD0' },
{ play: 'WF2', colour: 'R' },
{ play: 'WF2', colour: 'Y' },
{ play: 'WF2', colour: 'G' },
{ play: 'WF2', colour: 'B' },
{ draw: true }
]
}What it prints (run when this page was built)