Reference · Game engine and table
HitotsuViewtype
A COMPUTER AT THE HITOTSU TABLE. It sees its own hand, the pile, the colour to follow, what it faces, and how many cards each player holds — never another hand, and never whether a Wild Draw Four it faces was a bluff.
- Facing a draw, it stacks if it can (a Draw Two before a Wild Draw Four), and otherwise takes it — or challenges a Wild Draw Four played by a hand big enough that it most likely held the colour.
- On its turn it plays an ordinary card when it has one: an action card at the player next to go out, else the card that keeps it in the colour it holds most of and sheds the most points. Wilds are saved for when nothing else goes, and a Wild Draw Four for last, and it never bluffs one.
- A seven swaps with the smallest hand; a colour called is the one it holds most of. It always calls "Hitotsu!", and jumps in whenever it can.
- With nothing to play it draws, and plays the card drawn if it goes and is not a wild (which it keeps).
Import it
import type { HitotsuView } from "@johnmorrisdotca/hitotsu";
Definition
type HitotsuView = {
seat: number;
hand: readonly HitotsuCard[];
counts: readonly number[];
colour: HitotsuColour;
next: number;
drawn: HitotsuCard | null;
challengeFrom: number | null;
legal: readonly HitotsuMove[];
};
Members
| Name | Type | Description |
|---|---|---|
seat | number | |
hand | readonly string[] | |
counts | readonly number[] | |
colour | HitotsuColour | |
next | number | The seat that plays after this one, as things stand. |
drawn | string | null | |
challengeFrom | number | null | A Wild Draw Four this seat may challenge: who played it. Nothing of whether it was a bluff. |
legal | readonly HitotsuMove[] |
Examples
import type { HitotsuView } from "@johnmorrisdotca/hitotsu";
import { hitotsuView, startHitotsu } from "@johnmorrisdotca/hitotsu";
const value: HitotsuView = hitotsuView(startHitotsu(1, ["Aki", "Ben"], 42)!, 0);
console.log(value.counts);[ 7, 7 ]What it prints (run when this page was built)