Skip to content

Add Pocket Cube (2×2) optimal solver playground - #200

Closed
ianalloway wants to merge 1 commit into
mainfrom
claude/rubiks-729tge
Closed

Add Pocket Cube (2×2) optimal solver playground#200
ianalloway wants to merge 1 commit into
mainfrom
claude/rubiks-729tge

Conversation

@ianalloway

Copy link
Copy Markdown
Owner

What

A new /cube playground: a 2×2×2 Pocket Cube with a provably optimal solver. Scramble it, hit solve, and watch a bidirectional breadth-first search — running from the scrambled state and the solved state simultaneously until the two frontiers meet — find the shortest solution that exists, then play it back one turn at a time on an unfolded net. No 2×2 position ever needs more than 11 turns, and searching from both ends is what makes an exhaustive (and therefore optimal) search tractable in a browser.

How

  • src/features/cube/cube.ts — pure, framework-free core. The notable design choice: the move permutations are generated from 3D geometry, not hand-written cycle lists. Each of the 24 stickers is a (cubie position, outward normal) pair, and a face turn is a 90° rotation applied to both — so the permutations are correct by construction rather than by careful transcription.
    • validated locally with real group-theoretic fingerprints, not just smoke tests:
      • every face has order 4, and each move cancels with its inverse; X2 == X X
      • (R U R' U') has order 6 and (R U) has order 15 — the exact orders for the 2×2 corner group, which would break immediately if any rotation were mis-derived
      • 50 random scrambles are undone exactly by the inverted sequence
      • 60 random scrambles all solve (average 8.2 turns, longest 10 — inside God's number of 11), a solved cube returns an empty solution, and 1- and 2-move scrambles are solved in exactly 1 and 2 turns, confirming optimality
  • src/pages/Cube.tsx — unfolded-net renderer (U over L/F/R/B over D) with manual turn buttons for all 9 moves, scramble, solve (deferred so the "searching…" state paints before the search blocks), adjustable playback speed, and a solution ribbon that lights up each move as it executes.
  • src/App.tsx — lazy /cube route + SEO in the routes config.

Verification

  • npm run lint — 0 errors (only the two pre-existing react-refresh warnings in badge.tsx / button.tsx).
  • npm run build — succeeds.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WgEKRuVdor8KhaiPkv38aQ


Generated by Claude Code

Scramble a 2x2x2 cube and watch a bidirectional breadth-first search find
the shortest solution that exists, played back one turn at a time on an
unfolded net.

- src/features/cube/cube.ts: the 24 stickers and all six face
  permutations are derived from 3D rotations of (cubie position, outward
  normal) pairs rather than hand-written cycles, so they are correct by
  construction. Solver searches from the scramble and the solved state at
  once, meeting in the middle, which keeps an exhaustive (optimal) search
  tractable. Validated locally: every face has order 4 and cancels with
  its inverse, X2 == X X, (R U R' U') has order 6 and (R U) order 15 --
  the exact group fingerprints for the 2x2 corner group -- 50 scrambles
  undo cleanly under the inverted sequence, and 60 random scrambles all
  solve with average 8.2 and longest 10 turns, inside God's number of 11,
  with 1- and 2-move scrambles solved in exactly 1 and 2.
- src/pages/Cube.tsx: unfolded-net renderer with manual turn buttons,
  scramble, solve, playback speed, and a solution ribbon that highlights
  moves as they are executed.
- /cube route + SEO.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgEKRuVdor8KhaiPkv38aQ
@netlify

netlify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploy Preview for ianalloway ready!

Name Link
🔨 Latest commit d5ac1d8
🔍 Latest deploy log https://app.netlify.com/projects/ianalloway/deploys/6a63edaed01d8c0008577dbf
😎 Deploy Preview https://deploy-preview-200--ianalloway.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ian-web-forge Ready Ready Preview, Comment Jul 24, 2026 10:56pm

@ianalloway
ianalloway marked this pull request as ready for review July 24, 2026 22:58
Copilot AI review requested due to automatic review settings July 24, 2026 22:58
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ianalloway

Copy link
Copy Markdown
Owner Author

Closing this standalone playground PR to reduce the public queue and consolidate future playground work. The branch and commits are preserved for reopening or cherry-picking.

@ianalloway ianalloway closed this Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants