Three shogi variants on 9×9, 6×6 and 5×5 boards. Captured pieces change allegiance and return to play as drops, which is the mechanic the rest of the family is built around.
<iframe
src="https://engine.moddable.games/play/?embed=1&family=shogi&variant=minishogi"
style="width:100%;max-width:560px;aspect-ratio:1/1;border:none"
title="Play Shogi"
></iframe>
The parameters, commands and events are identical to every other family. See the Go page for the full table; substitute family=shogi.
Parameters follow the shogi hub in moddable-rules, and each setup is copied verbatim from the variant's frontmatter — the same string the published board diagram is drawn from.
| Key | Board | Zone | Distinguishing rule |
|---|---|---|---|
standard | 9×9 | 3 ranks | The full game, twenty pieces a side |
minishogi | 5×5 | 1 rank | Five pieces a side; no knight or lance |
judkins-shogi | 6×6 | 2 ranks | Six a side; knight retained, no lance |
gorogoro-plus | 5×6 | 1 rank | Simplified shogi with gold and silver only |
heian-shogi | 9×9 | 3 ranks | Historical predecessor; drunken elephant instead of bishop |
Players are sente and gote. Five variants are registered out of twenty-four in the hub; the rest are held back for the reasons under known gaps.
Symbols match the setup notation the variant frontmatter uses, so a position read from the rules parses here and renders through the piece mapping the board diagram already uses. Sente is player 0 and takes the uppercase letter.
| Type | Sente | Gote | Movement | Promotes to |
|---|---|---|---|---|
king | K | k | One step in any direction | — |
rook | R | r | Slides orthogonally | Adds one diagonal step |
bishop | B | b | Slides diagonally | Adds one orthogonal step |
gold | G | g | Six directions: all but the back diagonals | — |
silver | S | s | Five directions: forward three, back diagonals | Gold |
knight | N | n | Two forward, one sideways; jumps | Gold |
lance | L | l | Slides straight forward | Gold |
pawn | P | p | One step forward | Gold |
The plugin models a promoted piece as its own type — promoted_rook, promoted_silver and so on — rather than as a flag on the base piece. A flag would have to be consulted at every point movement is generated, and a piece carrying only a flag would be moved as though it were unpromoted.
The canonical notation writes a promoted piece as its base symbol behind a +, so serialisation resolves the type back to +R, +S and so on, and the setup parser resolves + markers forward to the promoted type on the way in.
Promotion is offered when a move starts or ends inside the zone, and both the promoting and non-promoting move appear in the list — except where the piece would otherwise have no legal move, in which case only the promotion is generated. That covers a pawn or lance reaching the last rank, and a knight reaching either of the last two.
A captured piece is demoted to its base type and added to the capturing player's hand, from which it may be dropped back onto any empty square as a whole turn. A captured king is not added, so no position can produce two kings for one side.
const state = game.getState().slice
state.hands // [['pawn','silver'], ['pawn']] indexed by player
game.applyMove({ action: 'drop', type: 'pawn', to: 40 })
Drop legality is generated, not validated after the fact. Pawns and lances may not be dropped on the last rank and knights not on the last two, since they would have no move. With dropPawnFileLimit set, a pawn may not be dropped onto a file that already holds one of your unpromoted pawns. Every drop is then filtered through the same check test as a board move, so a drop that leaves your own king in check never appears.
Hands always start empty for standard, minishogi, and judkins-shogi. Gorogoro+ opens with the knight and lance already in hand, handled via the variant's frontmatter setup.
The plugin is parametric, with no per-variant code:
| Parameter | Default | Effect |
|---|---|---|
rows / cols | 9 / 9 | Board dimensions |
promotionZone | 3 | Depth of the promotion zone in ranks, from each far edge |
dropPawnFileLimit | true | No two unpromoted pawns of one player on a file |
dropCheckmateLimit | true | Declared but not yet enforced — see gaps |
The plugin composes the rules capture.recruit, promotion.zone, check and checkmate.
import { createGame, getLegalMoves, getGameStatus, createAI, listVariants } from 'moddable-engine/play'
listVariants('shogi') // [{ key, label, group, board, description }]
const game = createGame('shogi', 'minishogi')
game.getLegalMoves() // [{ from, to, promote? }, { action: 'drop', type, to }, ...]
game.applyMove({ from: 21, to: 16, promote: true })
getGameStatus('shogi', 'minishogi', game.getState())
const ai = createAI('shogi', 'minishogi', { difficulty: 'hard' })
ai.pickMove(game.getState().slice, 0)
Shogi uses the drop interaction model, which behaves as the move model until a drop is armed from the hand:
ctrl.handleHandClick('pawn') // { type: 'arm-drop', dropType: 'pawn' }
ctrl.handleClick(square) // commits the drop, then clears the armed type
The play page has no hand. Drops are generated, legal and reachable through the controller's handleHandClick, but js/game-play.js renders no captured-piece tray, so a drop cannot currently be made by clicking. Board play, promotion and checkmate all work; a game that hinges on a drop cannot be finished through the page alone. The SDK and embed paths are unaffected.
dropCheckmateLimit is declared but not read. Dropping a pawn to deliver immediate checkmate — uchifuzume — is illegal in standard shogi and is currently allowed. The parameter exists in the config so the intent is recorded, but nothing consults it yet.
Nineteen hub variants are not registered. They fall into three groups:
Would play to the wrong rules, which is worse than being absent:
New piece types beyond the eight above: sho-shogi (the Drunken Elephant, which promotes to a second royal piece), chu-shogi, dai-shogi, tenjiku-shogi, maka-dai-dai-shogi, tai-shogi, taikyoku-shogi, tori-shogi, wa-shogi, yari-shogi and dobutsu.
Distinct mechanics rather than distinct pieces: kyoto-shogi (every piece flips to its alternate face after each move), annan-shogi (a piece moves using the move of the allied piece behind it), cannon-shogi, hasami-shogi, hex-shogi-91, sankaku-shogi and four-player-shogi.