A modern implementation of the 2048 game written in Rust, supporting multi-platform deployment.
- High Performance: Built with Rust, zero-cost abstractions
- Cross-Platform: Supports CLI, Web, and Desktop versions
- Multi-language Support: English and Chinese localization
- Modern UI: Smooth animations and beautiful interfaces
- AI Mode: Three AI algorithms with auto-play (CLI and Web versions)
- Theme System: 5 beautiful themes (Classic, Dark, Neon, Retro, Pastel)
- Replay System: Record and replay game sessions (CLI version)
- Statistics Charts: Comprehensive game analytics (CLI version)
- PWA Support: Progressive Web App with offline capability and app installation
- Auto-Save: Automatic game state saving and restoration (Web version)
- Responsive Design: Optimized for mobile and desktop devices (Web version)
๐ View Full Feature List - Detailed information about all features, controls, and capabilities.
๐ Browse All Documentation - Complete documentation index and guides.
rusty2048/
โโโ core/ # Core game logic library
โโโ cli/ # Command-line version (TUI)
โโโ web/ # Web version (WASM)
โโโ desktop/ # Desktop version (Tauri)
โโโ shared/ # Shared components
curl -fsSL https://raw.githubusercontent.com/honkinglin/rusty2048/main/scripts/install.sh | bash
Visit GitHub Releases to download binaries for your platform.
# Build all versions (CLI, Web, Desktop)
./build.sh
# Or build specific versions
./build.sh cli # CLI version only
./build.sh web # Web version only
./build.sh desktop # Desktop version only
# Run CLI version
./run.sh cli
# Run Web version (serves on localhost:8000)
./run.sh web
# Run Desktop version
./run.sh desktop
cargo run -p rusty2048-cli
cd desktop && cargo tauri dev
cd web && ./build.sh
cd web/dist && python3 -m http.server 8000
Web Version Features:
- ๐ฑ PWA Support: Install as native app with offline gaming capability
- ๐พ Auto-Save: Game progress automatically saved to local storage
- ๐ฑ Responsive Design: Perfectly adapted for mobile and desktop devices
- ๐ Offline Gaming: Support for gaming experience without network connection
๐ Live Demo: Play on Vercel - Install as PWA for offline play!
- Arrow Keys or WASD: Move tiles
- Mouse/Touch: Click buttons for New Game, Undo
- Language Button: Switch between English and Chinese
- Theme Buttons: Switch between 5 beautiful themes
๐ View Complete Controls - Detailed controls for all versions and modes.
- Rust 1.70+
- Cargo
core/
: Core game logic, including board, moves, scoring, replay system, etc.cli/
: Command-line interface using ratatui and crosstermweb/
: Web version using wasm-bindgendesktop/
: Desktop version using Taurishared/
: Shared components like themes and configurations
# Run all tests
cargo test
# Run benchmarks
cargo bench
# Run property tests
cargo test --features proptest
# Build all versions
./build.sh
# Build specific versions
./build.sh cli # CLI version
./build.sh web # Web version
./build.sh desktop # Desktop version
# CLI Version
cargo build --release -p rusty2048-cli
# Web Version
cd web && ./build.sh
# Desktop Version
cd desktop && cargo tauri build
- Core game logic
- CLI version with full features
- Web version (WASM) with PWA support
- Desktop version (Tauri)
- Replay system (CLI version)
- AI mode (CLI and Web versions)
- Statistics charts (CLI version)
- Multi-language support (all versions)
- Theme system (all versions)
- Auto-save functionality (Web version)
- Push notifications (Web version)
- Offline capability (Web version)
- AI mode for Desktop version
- Replay system for Web/Desktop versions
- Statistics charts for Web/Desktop versions
This project is licensed under the MIT License - see the LICENSE file for details.
Enjoy the game! ๐