Skip to content

w3b3d3v/rubiks-cube-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒŸ 12x12 Dodecahedron Simulator - Twizzle Edition

The ultimate 12-faced dodecahedron puzzle simulator built with Twizzle - the premier library for puzzle visualization and interaction.

Evolved Design: Started as a cube concept, then discovered the beauty of dodecahedrons! With 12 pentagonal faces, this creates a much more visually striking and complex puzzle experience than traditional cubes.

โœจ Features

๐ŸŽฏ Dodecahedron-Specific Functionality

  • Authentic 12-faced megaminx with proper dodecahedron mechanics
  • Advanced scrambling algorithms for realistic random states
  • Dodecahedron notation support (R, U, F, L, BL, BR, DR, D, DL, B, etc.)
  • Smooth animations with beautiful face rotations
  • Move execution with real-time algorithm tracking

๐ŸŽฎ Simple Controls

  • ๐Ÿ”€ Scramble: Generates proper dodecahedron scrambles (70 random moves)
  • โœจ Solve: Return to solved state instantly
  • ๐Ÿ“Š Move Counter: Track total moves and current algorithm

๐ŸŽจ Modern Interface

  • Responsive design that works on all devices
  • Beautiful gradient UI with glassmorphism effects
  • Real-time status updates showing moves and algorithms
  • Smooth animations and visual feedback

๐Ÿ† Why Twizzle is Superior

Compared to Three.js

Feature Twizzle Three.js
Setup Complexity ๐ŸŸข Simple (20 lines) ๐Ÿ”ด Complex (200+ lines)
Cube Knowledge โœ… Built-in algorithms โŒ Manual implementation
Scrambling โœ… Official algorithms โŒ Random colors only
Move Notation โœ… Standard R, U, F notation โŒ Custom implementation
Performance โœ… Optimized for cubes โš ๏ธ General 3D engine
Learning Curve ๐ŸŸข Easy for cube apps ๐ŸŸก General 3D knowledge

Compared to Other Cube Libraries

  • More mature than generic Cube.js libraries
  • Active development by the speedcubing community
  • Comprehensive feature set beyond just visualization
  • Proper cube mechanics vs simplified renderers

๐Ÿš€ How to Use

Access the Application

# The server is running at:
http://localhost:8000

Controls

๐ŸŽฎ Button Controls

  • ๐Ÿ”€ Scramble: Generate a new random state (70 moves with smart move avoiding)
  • โœจ Solve: Return dodecahedron to solved state

๐Ÿ–ฑ๏ธ Mouse Controls

  • Click & Drag: Rotate the cube view
  • Scroll: Zoom in/out
  • Mobile: Touch gestures supported

๐Ÿ’ป Technical Implementation

Architecture

// Clean, simple implementation with Twizzle
import { TwistyPlayer } from "https://cdn.cubing.net/js/cubing/twisty";

const player = new TwistyPlayer({
  puzzle: "megaminx",
  alg: "R U R' U' BL DR",
  visualization: "3D",
});

Key Advantages of This Implementation

  1. ๐ŸŽฏ Purpose-Built: Designed specifically for cube puzzles
  2. ๐Ÿ“ Proper Algorithms: Uses real scrambling and solving algorithms
  3. ๐Ÿ”ง Easy Maintenance: Much simpler codebase to extend and modify
  4. ๐Ÿš€ Better Performance: Optimized for cube-specific operations
  5. ๐Ÿ“ฑ Mobile Ready: Built-in touch and responsive support

File Structure

rubiks-cube/
โ”œโ”€โ”€ index.html          # Main HTML with modern UI
โ”œโ”€โ”€ style.css           # Glassmorphism styling
โ”œโ”€โ”€ app.js              # Twizzle integration (~250 lines vs 500+)
โ””โ”€โ”€ README.md           # This documentation

๐ŸŽ“ Learning and Extension

Easy to Extend

Adding new features is straightforward with Twizzle:

// Add solving algorithms
player.alg = "R U R' U' R U R' F' R U R' U' R' F R2 U' R'";

// Change puzzle type
player.puzzle = "3x3x3"; // or "4x4x4", "5x5x5", etc.

// Add different visualizations
player.visualization = "2D"; // or "3D", "experimental-2D-LL"

Future Enhancement Ideas

  • ๐Ÿค– Auto-solving: Implement solving algorithms
  • โฑ๏ธ Timer system: Track solving times
  • ๐ŸŽฏ Pattern recognition: Identify cube states
  • ๐Ÿ“ˆ Statistics: Move efficiency analysis
  • ๐ŸŒ Multiplayer: Real-time collaborative solving
  • ๐Ÿ“ฑ PWA: Offline mobile app capabilities

๐Ÿ†š Library Comparison Summary

๐Ÿฅ‡ Twizzle (Current Choice)

  • โœ… Perfect for cube projects
  • โœ… Minimal code required
  • โœ… Official algorithms built-in
  • โœ… Active speedcubing community
  • โœ… Easy to extend and maintain

๐Ÿฅˆ Three.js

  • โœ… Great for learning 3D programming
  • โœ… General-purpose 3D engine
  • โŒ Requires extensive cube knowledge
  • โŒ Much more complex setup
  • โŒ Not cube-optimized

๐Ÿฅ‰ Other Cube.js Libraries

  • โš ๏ธ Usually incomplete implementations
  • โš ๏ธ Limited community support
  • โš ๏ธ Often outdated or abandoned

๐Ÿ› ๏ธ Development

Local Development

# Server is already running on port 8000
# Just edit files and refresh browser

# To restart server if needed:
python3 -m http.server 8000

Browser Compatibility

  • โœ… Chrome/Edge: Full support
  • โœ… Firefox: Full support
  • โœ… Safari: Full support
  • โœ… Mobile browsers: Responsive design

๐ŸŽฏ Conclusion

This Twizzle-based implementation demonstrates why choosing the right library is crucial:

  • 20 lines of setup vs 200+ with Three.js
  • Official cube algorithms vs custom implementations
  • Proper cube mechanics vs basic 3D rendering
  • Future-proof with active development

The cube loads faster, works better, and is much easier to extend! ๐Ÿš€


Ready to start puzzling? Visit http://localhost:8000 and enjoy the ultimate 12-faced dodecahedron experience! ๐ŸŒŸโœจ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published