Skip to content

honkinglin/rusty2048

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

92 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Rusty2048

A modern implementation of the 2048 game written in Rust, supporting multi-platform deployment.

Quick Check CI

๐Ÿ–ผ๏ธ Screenshots

CLI Version Desktop Version Web Version

โœจ Features

  • 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.

๐Ÿ—๏ธ Project Architecture

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

๐Ÿš€ Quick Start

Install CLI Version (Recommended)

Method 1: One-click Installation Script

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

Method 2: Download Pre-compiled Binaries

Visit GitHub Releases to download binaries for your platform.

Development Build

# 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 Development Versions

# Run CLI version
./run.sh cli

# Run Web version (serves on localhost:8000)
./run.sh web

# Run Desktop version
./run.sh desktop

Manual Build (Alternative)

CLI Version

cargo run -p rusty2048-cli

Desktop Version

cd desktop && cargo tauri dev

Web Version

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!

๐ŸŽฎ Basic Controls

  • 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.

๐Ÿ› ๏ธ Development

Requirements

  • Rust 1.70+
  • Cargo

Project Structure

  • core/: Core game logic, including board, moves, scoring, replay system, etc.
  • cli/: Command-line interface using ratatui and crossterm
  • web/: Web version using wasm-bindgen
  • desktop/: Desktop version using Tauri
  • shared/: Shared components like themes and configurations

Testing

# Run all tests
cargo test

# Run benchmarks
cargo bench

# Run property tests
cargo test --features proptest

๐Ÿ“ฆ Build Targets

Using Root Scripts (Recommended)

# Build all versions
./build.sh

# Build specific versions
./build.sh cli      # CLI version
./build.sh web      # Web version  
./build.sh desktop  # Desktop version

Manual Build Commands

# CLI Version
cargo build --release -p rusty2048-cli

# Web Version
cd web && ./build.sh

# Desktop Version
cd desktop && cargo tauri build

๐ŸŽฏ Development Roadmap

โœ… Completed

  • 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)

๐Ÿ”„ Future Enhancements

  • AI mode for Desktop version
  • Replay system for Web/Desktop versions
  • Statistics charts for Web/Desktop versions

๐Ÿ“„ License

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

Enjoy the game! ๐ŸŽ‰

About

๐ŸŽฎ A Rust-powered 2048 with a beautiful UI, running everywhere: terminal, web, and desktop.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published