# Rubik's Cube Solver — Near-Optimal 3x3 Solutions

> Near-optimal 3x3 Rubik's Cube solving from a standard facelet string. A three-pass search (two-phase + inverse improvement + sharded deep search) returns short HTM solutions — typically 17–20 moves — with every result replay-verified. Zero dependencies, deterministic.

Rubik's Cube Solver — Near-Optimal 3x3 Solutions is a paid AI agent skill on Agensi by 悲观, in Game Development. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $19 (one-time purchase)
- Creator: [悲观](https://www.agensi.io/creators/creator-1600)
- Category: [Game Development](https://www.agensi.io/skills/game-development)
- Version: 1.0
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/rubik-s-cube-solver-near-optimal-3x3-solutions
- Tags: gaming, education, rubiks-cube, 3x3, puzzle-solver, two-phase-algorithm, search, games

## What it does

- Solves any valid 3x3 cube state given as a 54-character facelet string (Kociemba order U,R,F,D,L,B) and return
- Runs a three-pass search — min2phase-style two-phase solving, an inverse-problem improvement pass, and a shard
- Solves one cube from the command line or whole batches from a directory layout, writing one solution file per
- Verifies every solution it writes by replaying it against the input state, and ships an independent verifier s
- Includes a seeded scramble generator for reproducible testing, full algorithm documentation, and worked exampl

## Who it's for

- **Speedcubers and puzzle enthusiasts:** Short, trustworthy solutions for scrambles and practice states. Try: "Solve this cube: FRDFURDUURBRURDUDBLRFBFLBDBLLLDDFBURLUFFLLURDFFUBBLDBR"
- **Developers building cube, puzzle or game features:** A dependable solver component for their projects. Try: "I have a list of cube facelet strings. Can you solve them all and verify the results?"
- **Students and educators:** A real demonstration of two-phase search, pruning tables and symmetry reduction on a real problem. Try: "Give me a 25-move scramble and then show me the solution."
- **Agent and tooling builders:** A deterministic, offline solver their workflows can call. Try: "Solve this cube offline and verify the solution by replay."

## About this skill

Rubik's Cube Solver takes a scrambled 3x3 cube as a 54-character facelet string — the format used across the cubing ecosystem — and returns a short solution in standard Singmaster notation (half-turn metric). It is built around an original implementation of the classic two-phase approach: phase 1 drives the cube into the G1 subgroup (orientation solved, slice edges placed), phase 2 finishes the permutation using only the ten moves that preserve G1. Six conjugate frames, three-axis pruning and five pruning tables keep the search fast; symmetry reduction (twist 2187→324 classes, flip 2048→336, corner permutation 40320→2768) keeps the tables small. Two extra passes squeeze out extra moves on hard cubes. If the two-phase result is 19 moves or longer, the solver attacks the inverse cube with a tightened budget and keeps any strictly shorter, replay-verified improvement. If the result is still 18 or longer, a sharded deep search — blocks keyed by phase-1 length, conjugate frame and first pre-move, scheduled cheapest-first under a fixed 70M-node budget — hunts for one more move. Everything is deterministic: all budgets are fixed counters, never clocks, so the same input always produces byte-identical output. Every solution is verified by replay before it is written, and the package includes the verifier, a seeded scramble generator, three worked examples with real outputs, and full documentation of the algorithm and the I/O format. Zero dependencies, no network access, runs anywhere Node.js 22 runs.

## Requires

- Node.js 22.18+

## Known limitations

Near-optimal, not proven optimal: the search is budgeted and does not prove no shorter solution exists.
Worst-case runtime is budget-bound: a hard cube can take tens of seconds on a slow or shared CPU while the deep-search pass spends its fixed node budget.
3x3 only; solutions are HTM only (no QTM or slice-move notation).
Input must be a physically reachable cube state; the solver assumes valid facelet strings.

## Technical details

Requires Node.js 22.18+ (erasable-syntax TypeScript, executed directly by Node; standard library only). Entry points: scripts/main.ts (batch: reads <input>/<id>/cube.txt, writes <output>/<id>/solution.txt; directories via RUBIK_INPUT_DIR / RUBIK_OUTPUT_DIR), scripts/solve.ts (single cube), scripts/verify.ts (replay verification), scripts/scramble.ts (seeded scramble generator). Tools used: Terminal/Shell, Read Files, Write Files. Typical runtime: ~1–3 s for easy/medium cubes; hard cubes that trigger the deep-search pass can take tens of seconds on a slow core (budget is node-count based).

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Rubik's Cube Solver — Near-Optimal 3x3 Solutions skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What does Rubik's Cube Solver — Near-Optimal 3x3 Solutions do?

Near-optimal 3x3 Rubik's Cube solving from a standard facelet string. A three-pass search (two-phase + inverse improvement + sharded deep search) returns short HTM solutions — typically 17–20 moves — with every result replay-verified. Zero dependencies, deterministic.

### Which AI agents support Rubik's Cube Solver — Near-Optimal 3x3 Solutions?

This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

### How do I use Rubik's Cube Solver — Near-Optimal 3x3 Solutions?

Connect your AI agent to Agensi through MCP, then ask it to use Rubik's Cube Solver — Near-Optimal 3x3 Solutions on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
