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

Reference

Views, replay and player

import { … } from "@johnmorrisdotca/gunjin";

12.9 kB minified and gzipped, with everything it imports (measured with esbuild)

SVG board rendering and its optional visual settings.

Exports

NameKindWhat it is
boardFeaturesfunctionPublic board markings (camps, headquarters and lakes), with no role-dependent information.
CoordinatetypeZero-based board location shared by engine actions and public views.
decodePublicReplayfunctionValidates a role-free replay record for display; it cannot resume a match.
drawGunjinBoardfunctionDraws only a redacted player view.
DrawOptionstypeVisual settings and temporary selection marks for the role-redacted SVG renderer.
encodePublicReplayfunctionSerializes the role-redacted public replay record as JSON.
GameModetypeSelects one of the five rule modules supported by this package.
GUNJIN_STYLEconstantScoped presentation styles applied by the hotseat mount.
GunjinMounttypePublic controls returned by mountGunjin; no authoritative state is exposed.
LanguagetypeSupported interface locales.
legalMovesForCurrentPlayerfunctionLegal move coordinates for the player whose turn it is; roles are never returned.
MatchResulttypePublic outcome recorded when a match ends.
MaterialtypeBoard palettes shared with the game family.
modeNamefunctionReturns the localized display name for a ruleset.
mountGunjinfunctionMounts a hotseat player.
MountOptionstypeLocale, materials, and safe public callbacks for a mounted hotseat player.
MoveActiontypeMove requests are public, deterministic and rejected if their turn is stale.
PieceStyletypeAvailable piece silhouettes.
PlayertypeThe player whose private side is red.
playerNamefunctionReturns the localized name for one side.
PlayerViewtypeInformation safe to render for one player at the current pass boundary.
publicPositionfunctionRedacted position for spectators: only player ownership and occupied cells are returned.
PublicPositiontypeRole-free current position suitable for observers and change callbacks.
publicReplayfunctionCreates a public replay with only combat ranks that the selected rules expose.
PublicReplaytypeA shareable record without private setups or piece IDs; only mode-published combat ranks may appear.
roleNamefunctionReturns a localized piece label, with a readable fallback for unknown roles.
STRINGSconstantEnglish and Japanese interface labels used by the renderer and player.
ViewedPiecetypePlayer-facing piece.
viewForPlayerfunctionA player view redacts opponent roles and suppresses the board during device handoff.
wordsfunctionReturns the localized interface string table.

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