♟️ Checkers (Draughts)
A terminal-based American Checkers game written in Go featuring turn-based play, multi-jump sequences, forced captures, piece promotion, and win detection with a clean CLI interface.
<End Column> (e.g. C1D2)
Project Overview
This Checkers (English Draughts) implementation is a complete, terminal-based game written in Go that demonstrates clean code architecture and game development principles. The project implements all standard American Checkers rules including diagonal movement, forced captures, multi-jump sequences, and piece promotion.
Built as a learning exercise in structuring a small Go CLI game, the code is intentionally compact and readable while maintaining full functionality. The game features an 8x8 board with proper coordinate system (A-H rows, 1-8 columns), turn-based gameplay, and intelligent input validation.
The project showcases practical application of Go's strengths in CLI applications, including clean package structure, efficient algorithms for move validation, and user-friendly terminal interface design with Unicode piece representation.
Key Features
Game Mechanics
- Turn-based play between Red and Black players
- Standard diagonal movement rules for pieces
- Automatic forced capture detection and enforcement
- Multi-jump capture sequences in single commands
- Piece promotion to Queen (King) at far ranks
- Win detection when opponent has no pieces
User Interface & Controls
- Clean 8x8 board display with coordinate labels
- Unicode piece symbols (🔴/🟥 vs ⚫️/⬛️)
- Intuitive coordinate input system (A1-H8)
- Chain move input for multi-jumps (e.g., C3E5G7)
- Case-insensitive input parsing
- Clear error messages and move validation
Game Rules Implementation
Movement & Capture Logic
The game implements authentic American Checkers rules with proper direction restrictions and capture mechanics.
// Movement Rules: • Normal Red pieces: move down (toward H) • Normal Black pieces: move up (toward A) • Queens: move both forward and backward • Captures: jump diagonally over opponent pieces • Multi-jumps: chain captures in single turn • Forced captures: must capture if available
Promotion & Advanced Features
- Automatic promotion to Queen when reaching opposite end
- Queen pieces gain bidirectional movement capabilities
- Forced capture validation prevents invalid quiet moves
- Multi-jump sequence validation ensures legal continuity
- Board state copying for move validation dry-runs
- Win condition detection (no remaining pieces)
Technical Implementation
Clean Architecture
The project follows Go best practices with a clean package structure separating concerns between CLI interface and game logic.
cmd/checkers/ # Entry point (main package) internal/board/ # Core game logic: board state, movement, validation internal/cli/ # Command-line loop, input parsing, turn handling bin/ # Build artifacts
Key Algorithms
Core game mechanics implemented with efficient validation and state management.
• ValidateMoveSequence(): Validates entire multi-jump chains • PlayerHasCapture(): Enforces forced capture rules • Board copying: Safe state manipulation for validation • Direction restrictions: Piece-specific movement logic • Input parsing: Batch processing of move sequences
Usage & Installation
Installation
# Clone and build git clone https://github.com/neilsmahajan/checkers.git cd checkers make build # or: go build -o bin/checkers ./cmd/checkers # Run the game ./bin/checkers
Gameplay Examples
C3D4
C3E5
C3E5G7
Development Highlights
Technical Achievements
- Atomic move sequence validation and execution
- Efficient board state management with copying
- Robust input parsing with error handling
- Clean separation of game logic and UI
- Unicode rendering for cross-platform compatibility
- Makefile integration for build automation
Game Features
- Complete American Checkers rule implementation
- Forced capture enforcement
- Multi-jump chain processing
- Piece promotion mechanics
- Win/loss detection
- Case-insensitive, user-friendly input
Current Limitations & Future Improvements
Potential Enhancements
- Unit test coverage for move validation and game logic
- Stalemate detection (no legal moves available)
- AI opponent implementation (minimax/alpha-beta pruning)
- Move history and PGN-like logging
- Enhanced error messaging for better UX
- ASCII fallback for terminals without Unicode support
- Automated continuation of incomplete capture chains
- Web or TUI (text UI) interface options
Note: The current implementation focuses on core gameplay mechanics and clean code structure, making it an excellent foundation for additional features and game modes.
Learning Outcomes
Go Programming Skills
- Package organization and internal visibility
- Struct design and method implementation
- Input validation and error handling
- String parsing and coordinate systems
- Build automation with Makefiles
- CLI application architecture patterns
Game Development Concepts
- Turn-based game loop implementation
- Board game rule enforcement
- State validation and rollback mechanisms
- User input processing and command parsing
- Game state representation and manipulation
- Win condition detection algorithms
Game Session Example
Here's what a typical game session looks like (multi-jump chain):