| Crates.io | pixel-chess |
| lib.rs | pixel-chess |
| version | 0.1.1 |
| created_at | 2026-01-14 19:13:14.852634+00 |
| updated_at | 2026-01-16 16:21:25.043141+00 |
| description | A terminal chess game with pixel art pieces, mouse support, and PGN save/load |
| homepage | |
| repository | https://github.com/Spyabo/pixel-chess |
| max_upload_size | |
| id | 2043485 |
| size | 261,896 |
A terminal-based chess game built in Rust with pixel art pieces, mouse support, and full PGN save/load functionality.
# Install from crates.io
cargo install pixel-chess
pixel-chess
# Or clone and build
git clone https://github.com/Spyabo/pixel-chess.git
cd pixel-chess
cargo run --release
Requires Rust (1.70+).
f) or auto-flip on turn change (F)| Key | Action |
|---|---|
| Arrow keys | Move cursor |
| Enter | Select/move piece |
| Mouse click | Select/move piece |
H |
Toggle move history panel |
S |
Save game (enter player names) |
L |
Load game (fuzzy search) |
f |
Flip board |
F |
Toggle auto-flip |
R |
Reset game |
Q / Esc |
Quit |
src/
├── main.rs # Entry point, CLI args
├── tui.rs # Terminal UI, input handling, rendering
├── board/
│ ├── mod.rs # Board state, move execution, game logic
│ └── position.rs # Square coordinates (e.g., e4 -> (4,3))
├── pieces/mod.rs # Piece types, colors, FEN parsing
├── moves/mod.rs # Move struct with from/to positions
├── pgn.rs # PGN export/import, player names
└── pixel_art/
├── board_widget.rs # Main board renderer with sprites
├── sprites.rs # 8x8 pixel art for each piece
├── colours.rs # Square colors (light/dark/highlight)
├── captured_bar.rs # Shows captured pieces + material
├── move_history.rs # Scrollable move list widget
├── promotion_modal.rs
├── save_game_modal.rs
├── load_game_modal.rs
└── game_over_modal.rs
Pixel Art Rendering (pixel_art/sprites.rs):
Each piece is an 8x8 grid of Pixel enums (Transparent/Primary/Outline/Accent). Two vertical pixels are combined into one terminal character using Unicode half-blocks (▀), giving 8x8 pixel resolution in 8x4 character cells.
Move Validation (board/mod.rs):
Legal moves are computed by generating pseudo-legal moves, then filtering out those that would leave the king in check. Special moves (castling, en passant, promotion) are handled explicitly.
PGN Parsing (pgn.rs):
Algebraic notation like Nf3 is parsed by finding which knight can legally move to f3. Disambiguation (Rab1) is supported for ambiguous moves.
cargo build --release
The optimized binary will be at target/release/cli-chess (~3MB). This runs significantly faster than debug builds.
MIT