Skip to the content

Gunjin軍人

Play five hidden-rank games, keep setups private, share redacted views and replay, and pass one device between players.

Gunjin is the Japanese word 軍人 for a soldier. About the name

Contents

How-to

Mount the native shared-device player

Keep independent instances and expose only redacted handles/callbacks.

Keep the mount handle

import { createHasamiMatch } from "@johnmorrisdotca/gunjin/hasami";
import { mountGunjin } from "@johnmorrisdotca/gunjin/play";
const host=document.createElement("div");
document.body.append(host);
const board=mountGunjin(host,createHasamiMatch({width:7,height:7}),{language:"ja",onChange:position=>console.log(position.phase)});
board.set({material:"wood",pieceStyle:"tiles"});
console.log(board.view().phase,board.replay().length);
board.destroy();

The handle exposes redacted views/replay, presentation updates and cleanup. Change/finish callbacks receive public data rather than a full authoritative match. The local hotseat player internally owns both sides and uses the handoff screen to manage shared-device privacy. A competitive remote host needs its own authenticated state boundary.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/gunjin 0.2.1.