Add Pocket Cube (2×2) optimal solver playground - #200
Closed
ianalloway wants to merge 1 commit into
Closed
Conversation
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
✅ Deploy Preview for ianalloway ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ianalloway
marked this pull request as ready for review
July 24, 2026 22:58
|
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. |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new
/cubeplayground: 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.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-derivedsrc/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/cuberoute + SEO in theroutesconfig.Verification
npm run lint— 0 errors (only the two pre-existingreact-refreshwarnings inbadge.tsx/button.tsx).npm run build— succeeds.🤖 Generated with Claude Code
https://claude.ai/code/session_01WgEKRuVdor8KhaiPkv38aQ
Generated by Claude Code