Skip to content

Rusty2048 is a modern, high-performance implementation of the classic 2048 puzzle game. Built entirely in Rust, it delivers exceptional performance across multiple platforms while maintaining a clean, maintainable codebase.

License

Notifications You must be signed in to change notification settings

davismiler/rusty2048

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

95 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Rusty2048

A high-performance, cross-platform 2048 game implementation built with Rust

CI Quick Check License: MIT Rust


๐Ÿ“‹ Table of Contents


๐ŸŽฏ About

Rusty2048 is a modern, high-performance implementation of the classic 2048 puzzle game. Built entirely in Rust, it delivers exceptional performance across multiple platforms while maintaining a clean, maintainable codebase.

Why Rusty2048?

  • โšก Blazing Fast: Leverages Rust's zero-cost abstractions for optimal performance
  • ๐ŸŽจ Beautiful UI: Smooth animations and modern design across all platforms
  • ๐ŸŒ Cross-Platform: Play on CLI, Web, or Desktop with a consistent experience
  • ๐Ÿค– AI-Powered: Watch intelligent algorithms play or learn from them
  • ๐Ÿ“Š Analytics: Track your progress with comprehensive statistics
  • ๐Ÿ”ง Highly Customizable: Multiple themes, languages, and configuration options

โœจ Features

Core Gameplay

  • โœ… Classic 2048 gameplay with smooth tile animations
  • โœ… Undo functionality for strategic gameplay
  • โœ… Score tracking with best score persistence
  • โœ… Configurable board size and target score
  • โœ… Game state persistence and auto-save

Advanced Features

  • ๐Ÿค– AI Mode: Three intelligent algorithms (Greedy, Expectimax, MCTS) with auto-play
  • ๐ŸŽจ Theme System: 5 beautiful themes (Classic, Dark, Neon, Retro, Pastel)
  • ๐ŸŒ Internationalization: Full support for English and Chinese
  • ๐Ÿ“Š Statistics: Comprehensive game analytics with visual charts (CLI)
  • ๐Ÿ”„ Replay System: Record and replay game sessions (CLI)
  • ๐Ÿ“ฑ PWA Support: Install as a native app with offline capability (Web)

Platform-Specific

  • CLI: Full-featured terminal UI with charts, replays, and AI mode
  • Web: Progressive Web App with responsive design and touch support
  • Desktop: Native desktop application built with Tauri

๐Ÿ“– For detailed feature documentation, see FEATURES.md


๐Ÿ–ผ๏ธ Screenshots

CLI Version Desktop Version Web Version
CLI Version Desktop Version Web Version

๐Ÿš€ Quick Start

Install CLI Version

One-line installation:

curl -fsSL https://raw.githubusercontent.com/davismiler/rusty2048/main/scripts/install.sh | bash

Or download pre-built binaries:

  • Visit GitHub Releases
  • Download for your platform (Linux, macOS, Windows)
  • Extract and run the binary

๐Ÿ“ฆ Installation

CLI Version

Option 1: Installation Script (Recommended)

curl -fsSL https://raw.githubusercontent.com/davismiler/rusty2048/main/scripts/install.sh | bash

Option 2: Pre-compiled Binaries

Download from GitHub Releases for your platform.

Option 3: Build from Source

git clone https://github.com/davismiler/rusty2048.git
cd rusty2048
cargo build --release -p rusty2048-cli

Web Version

Play Online: rusty2048.vercel.app

Build Locally:

git clone https://github.com/davismiler/rusty2048.git
cd rusty2048/web
./build.sh
# Serve the dist folder with any static file server

Desktop Version

Build from Source:

git clone https://github.com/davismiler/rusty2048.git
cd rusty2048/desktop
cargo tauri build

๐Ÿ“– For detailed build instructions, see BUILD_GUIDE.md


๐ŸŽฎ Usage

Basic Controls

Action CLI Web/Desktop
Move Tiles Arrow Keys / WASD Arrow Keys / WASD / Swipe
New Game R Click "New Game"
Undo U Click "Undo"
Change Theme T or 1-5 Click Theme Buttons
Switch Language L Click Language Button
Quit Q or ESC Close Window

Advanced Features (CLI)

  • AI Mode: Press I to toggle AI, O for auto-play
  • Replay System: Press P to enter replay mode
  • Statistics: Press C to view game analytics
  • Help: Press H for theme help

๐Ÿ“– For complete controls documentation, see FEATURES.md


๐Ÿ’ป Platforms

Command Line Interface (CLI)

  • Best for: Developers, terminal enthusiasts, advanced features
  • Features: Full AI mode, replay system, statistics charts
  • Requirements: Terminal emulator

Web Application

  • Best for: Casual players, mobile users, quick access
  • Features: PWA support, offline play, responsive design
  • Requirements: Modern web browser

Desktop Application

  • Best for: Native desktop experience
  • Features: Native performance, system integration
  • Requirements: Tauri runtime

๐Ÿ› ๏ธ Development

Prerequisites

  • Rust: 1.70 or higher
  • Cargo: Rust's package manager (included with Rust)
  • Node.js: 20+ (for web version)
  • System Dependencies: See BUILD_GUIDE.md

Project Structure

rusty2048/
โ”œโ”€โ”€ core/        # Core game logic library
โ”œโ”€โ”€ cli/         # Command-line interface (TUI)
โ”œโ”€โ”€ web/         # Web version (WASM)
โ”œโ”€โ”€ desktop/     # Desktop version (Tauri)
โ””โ”€โ”€ shared/      # Shared components (i18n, themes)

Building

Build all versions:

./build.sh

Build specific version:

./build.sh cli      # CLI only
./build.sh web      # Web only
./build.sh desktop  # Desktop only

Running Development Versions

./run.sh cli      # Run CLI version
./run.sh web      # Run Web version (localhost:8000)
./run.sh desktop  # Run Desktop version

Testing

# Run all tests
cargo test

# Run benchmarks
cargo bench

# Run property-based tests
cargo test --features proptest

Code Quality

# Format code
cargo fmt

# Lint code
cargo clippy --all-targets --all-features -- -D warnings

๐ŸŽฏ Roadmap

โœ… Completed Features

  • Core game logic and mechanics
  • CLI version with full feature set
  • Web version (WASM) with PWA support
  • Desktop version (Tauri)
  • AI mode with three algorithms (CLI & Web)
  • Replay system (CLI)
  • Statistics and charts (CLI)
  • Multi-language support (English, Chinese)
  • Theme system (5 themes)
  • Auto-save functionality (Web)
  • Offline capability (Web)

๐Ÿ”„ Planned Features

  • AI mode for Desktop version
  • Replay system for Web/Desktop versions
  • Statistics charts for Web/Desktop versions
  • Additional language support
  • Custom theme creation
  • Online leaderboards
  • Multiplayer mode

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

For more details, please read our Contributing Guidelines (if available).


๐Ÿ“ž Contact

Project Maintainer: davismiler


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with โค๏ธ and Rust

โญ Star this repo if you find it helpful!

About

Rusty2048 is a modern, high-performance implementation of the classic 2048 puzzle game. Built entirely in Rust, it delivers exceptional performance across multiple platforms while maintaining a clean, maintainable codebase.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published