Skip to the content

Hitotsu一つ

Match the colour or number, call with one card left, and play classic or party rules against computers or at a shared table.

Hitotsu is Japanese for one: the call with one card left. About the name

Contents

Reference · Game engine and table

HitotsuGametype

A GAME OF HITOTSU: its table and moves (what is kept), and the hand they have reached. size is the score that wins — 200 or 500 — or 1 for a game of a single hand.

Import it

import type { HitotsuGame } from "@johnmorrisdotca/hitotsu";

Definition

type HitotsuGame = {
    size: number;
    players: readonly string[];
    computers: readonly boolean[];
    seed: number;
    options: HitotsuOptions;
    moves: readonly HitotsuMove[];
    hand: number;
    phase: "playing" | "over";
    hands: HitotsuCard[][];
    stock: HitotsuCard[];
    discard: HitotsuCard[];
    colour: HitotsuColour;
    direction: 1 | -1;
    toPlay: number | null;
    drawn: HitotsuCard | null;
    pending: number;
    pendingFace: "D" | "F" | null;
    challenge: HitotsuChallenge | null;
    passes: number;
    turnovers: number;
    scores: number[];
    results: HitotsuResult[];
    news: HitotsuNews[];
};

Members

NameTypeDescription
sizenumber
playersreadonly string[]
computersreadonly boolean[]
seednumber
optionsHitotsuOptions
movesreadonly HitotsuMove[]
handnumber

Which hand this is, from 0: it decides who plays first.

phase"playing" | "over"
handsstring[][]
stockstring[]

Face down, top card first.

discardstring[]

Face up, top card last.

colourHitotsuColour

The colour to follow: the top card's, or the one a wild called.

direction1 | -1

1 round the table to the left, -1 after a reverse.

toPlaynumber | null
drawnstring | null

The card the player to move has just drawn, the only one they may now play; null before they draw.

pendingnumber

Cards the player to move must take unless they stack a draw card on them.

pendingFace"D" | "F" | null

The last draw card stacked, for "same card" stacking: D or F.

challengeHitotsuChallenge | null
passesnumber

Turns passed in a row with nothing to play or draw: when every player has, the hand is blocked.

turnoversnumber

How many times the discards have been shuffled into a new stock this hand.

scoresnumber[]
resultsHitotsuResult[]
newsHitotsuNews[]

What the last move did, beyond the card itself.

Examples

import type { HitotsuGame } from "@johnmorrisdotca/hitotsu";
import { startHitotsu } from "@johnmorrisdotca/hitotsu";

const value: HitotsuGame = startHitotsu(1, ["Aki", "Ben"], 42)!;
console.log(value.hands.map((hand) => hand.length));
[ 7, 7 ]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hitotsu 1.4.0.