A Chinese Chess (象棋/Xiangqi) game for Kindle e-readers, built on the Wukong JavaScript engine by Code Monkey King.
- vs AI mode — play as Red or Black against the Wukong engine
- Two Player mode — local hot-seat play
- 3 AI difficulty levels — Easy (depth 1), Medium (depth 3), Hard (depth 5)
- Traditional board style — pieces on intersections, 楚河漢界, palace diagonals
- e-ink optimized — black & white, minimal refresh, touch-friendly
- Popup menu — New Game, Undo, Flip Board, Show/Hide Moves, Main Menu
- Move history — toggleable PGN display in UCI notation
- Piece styles — Red: white background red text; Black: black background white text
- Engine: Wukong Xiangqi — pure JavaScript, negamax + alpha-beta pruning + Zobrist hashing + repetition detection
- UI: Vanilla HTML/CSS/JavaScript (no frameworks, no dependencies)
- Board rendering: SVG data URL background + absolutely positioned pieces on intersections
- Runtime: Kindle Mesquite (WebKit-based app container, ~Safari 5 / ES5)
xiangqi/
├── config.xml # Mesquite widget configuration (must include <feature> + <kindle:messaging>)
├── index.html # Game UI + Chrome bar integration
├── main.css # Board styling (e-ink optimized, pieces on intersections)
├── main.js # Game logic + UI binding (ES5 only)
├── shortcut_xiangqi.sh # Kindle launcher shortcut (with embedded base64 icon)
├── assets/
│ └── wukong.js # Wukong Xiangqi engine (Babel-transpiled to ES5)
├── kual_extension/ # KUAL extension for easy launching
│ ├── config.xml
│ ├── menu.json
│ └── bin/
│ └── launch.sh # Copy of shortcut script
├── AGENTS.md # Development notes for AI agents
└── README.md
- Copy the
xiangqi/folder to/mnt/us/documents/xiangqi/on your Kindle - Copy the
kual_extension/folder to/mnt/us/extensions/xiangqi/ - Eject the Kindle, open KUAL, select Xiangqi → Install & Launch
- The script copies game files to
/var/local/mesquite/xiangqi/, registers the app, and launches it
- Copy the
xiangqi/folder to/mnt/us/documents/xiangqi/on your Kindle - Copy
shortcut_xiangqi.shto/mnt/us/documents/shortcut_xiangqi.sh - Eject the Kindle and tap the "Xiangqi" entry in your library
Note: After updating game files, you must re-run the shortcut/KUAL extension
to copy the new files to /var/local/mesquite/xiangqi/. Launching directly from
the Kindle app list uses cached files.
- Select game mode from the menu (vs AI Red, vs AI Black, or Two Player)
- Tap a piece to select it — legal moves are highlighted with dots
- Tap a destination intersection to move; tap a capturable piece to capture
- In AI mode, the engine responds automatically
- Tap
[Menu]in the top-right for game controls
| Red | Black | Piece |
|---|---|---|
| 帅 | 将 | King (General) |
| 仕 | 士 | Advisor (Guard) |
| 相 | 象 | Bishop (Elephant) |
| 马 | 马 | Knight (Horse) |
| 炮 | 炮 | Cannon |
| 车 | 车 | Rook (Chariot) |
| 兵 | 卒 | Pawn (Soldier) |
- Kindle Paperwhite 4 (10th Gen) — tested
- Other Kindle models with Mesquite + touch support should work
- Requires jailbroken Kindle with KUAL installed
- Engine: Wukong Xiangqi by maksimKorzh (Code Monkey King), MIT License
- Game UI: Built for Kindle Mesquite, inspired by KShips and KWordle
- KUAL extension pattern: Based on the Kindle homebrew community
- Game UI code: MIT
- Wukong engine: See
assets/wukong.jsfor original license