Skip to content
0xtrouPublic

About

Challenge the Jev's intelligence in Rubik Cube puzzles

Resources

Stars

7 stars

Watchers

0 watching

Forks

Repository files navigation

🧊 JEV SOLVES THE CUBE 🗿

You scramble like a menace. Jev — the in-house AI solver — judges the chaos, roasts you, and cooks the solve live.

Live Site Next.js Three.js Tailwind

TypeSafe Jev shadcn/ui Vercel Compliance

GitHub X GitHub Followers Stars

An AI-gamified twisty puzzle — scramble it, gamble it, watch Jev cook. 🎰

Jev Solves The Cube

✨ What is this?

A one-page, no-scroll Rubik's cube playground with an AI attitude:

  1. 🌪️ You scramble — pick a preset (Chill → Spicy → GIGACHAD → 🤯 UNHINGED), mash the manual turn buttons, or unleash a custom number of turns (up to 4900).
  2. 🧠 Jev judges — a System One judgment model rates your chaos: one of five meme tiers, a 1–5 star difficulty rating, and exactly one roast.
  3. 🤖 Jev solves — an agent loop: Jev reads the live cube state, picks its next job from a toolbox step by step, and every move streams over SSE while the 3D cube executes it at adaptive speed.
  4. 🎰 You gamble — bank the XP, or feed it to Jev's Gambit: a double-or-nothing slot machine (×2, ×3, ×5, ×10… or 💀 bust).

Plus: XP, ranks (NPC → Mid Scrambler → Certified Cook → GIGACHAD → Sigma Orchestrator), badges, run stats, confetti, victory spins, and a live feed that never stops talking.

🕹️ How to play

Step Action
1 Choose a preset or hand-scramble / unleash custom turns
2 Hit SCRAMBLE — the cube shakes while chaos is applied
3 Hit SOLVE WITH JEV — verdict streams in, cube animates the solve
4 Watch the ✅ SOLVED banner with your run stats
5 🏦 Bank the XP… or 🎲 double or nothing it on the slot
6 Climb the ranks: NPC → Mid Scrambler → Certified Cook → GIGACHAD → Sigma Orchestrator

🏗️ Architecture

┌────────────────────────── browser ──────────────────────────┐
│  Next.js App Router · React Three Fiber · Tailwind v4       │
│  shadcn/ui · zustand (localStorage) · canvas-confetti       │
│  receives ONLY curated game events (SSE)                    │
└──────────────────────────────┬──────────────────────────────┘
                               │  POST /api/solve
                               │  { history: ["R","U'",…] }
┌──────────────────────────────▼──────────────────────────────┐
│  /api/solve  (server-only route)                            │
│  • validates + simplifies the scramble                      │
│  • computes the real cube state (cubie model + facelets)    │
│  • MOVE-BY-MOVE LOOP: Jev judges EVERY single move — the    │
│    18-move alphabet is declared once, then it sees only the │
│    live cube state (facelets + progress — NEVER the move    │
│    history) each turn and plays one move; the only non-Jev  │
│    moves are the superhuman tool's, streamed only when Jev  │
│    itself invokes it (tagged ⚡) — no engine, no rotation    │
│  • judgment pass via engine adapter  ──►  JEV (AI verdict)  │
│  • every solution verified vs a reference model before      │
│    streaming; raw inference is never leaked                 │
│  • streams curated events: meta ▸ waypoint ▸ move ▸ done    │
└─────────────────────────────────────────────────────────────┘

The cube machinery (adapted from buuing/Rubiks-Cube, the most-starred Three.js cube, rebuilt for React Three Fiber) only turns for judged moves: Jev plays one judged move per call against the live state; the sole non-Jev mover is the Kociemba two-phase solver, and only when Jev itself invokes it as a tool (tagged ⚡ in the stream). Every solve is verified against an independent reference model before streaming, and the 📜 Audit tab logs every turn that rotated the cube (🌪️ yours · 🧠 Jev's · ⚡ its tool's). Harnesses: pnpm check (scripts/solver-check.mjs: model + facelets + randomized Kociemba, reference cross-checked) and scripts/cube-math-check.mjs (200 animation-math trials). Every cubie returns home, always.

🔐 Security & compliance

The AI provider is a deliberate implementation detail:

Secret Where it lives
JEV_ENGINE_API_KEY Server env only (Vercel Secret / .env.local) — never NEXT_PUBLIC_*
JEV_ENGINE_BASE_URL Server env only — the engine endpoint is not hardcoded anywhere
Raw inference (questions, criteria, probabilities, model ids, latency) Stays inside the API route — never logged, never streamed
Client bundle Zero provider strings (verified by bundle grep — see COMPLIANCE.md §5)

The client receives exactly five curated event types — meta, waypoint, move, done, error — signed engine: "jev-stream/1", plus a generic token count.

📄 COMPLIANCE.md maps every obligation of the engine's Master Customer Agreement (license scope §2.1–2.3, credentials §2.4, input/output handling §4, end-user disclosures §5, publicity §15.4) to the exact files and mechanisms that satisfy it — including the deliberate no-benchmarks rule (§2.3f) and the provider-anonymized public copy.

🚀 Getting started

# 1. install
pnpm install

# 2. configure the engine (server-only secrets)
echo 'JEV_ENGINE_API_KEY=<your-key>'  >> .env.local
echo 'JEV_ENGINE_BASE_URL=<endpoint>' >> .env.local

# 3. run
pnpm dev        # http://localhost:3000

# 4. verify the cube math anytime
node scripts/cube-math-check.mjs
node scripts/cube-stress-large.mjs

⚙️ Scripts

Command What it does
pnpm dev Dev server
pnpm build Production build
pnpm start Serve the production build
pnpm check cube model + facelets + Kociemba harness (reference cross-checked)
node scripts/cube-math-check.mjs 200-trial animation-math correctness harness
node scripts/cube-stress-large.mjs 500-turn scramble stress harness

📁 Project map

src/
├── app/
│   ├── api/solve/route.ts        🔒 Jev agent loop + SSE stream (server-only)
│   ├── opengraph-image.tsx       dynamic OG image (ImageResponse)
│   ├── layout.tsx                fonts · metadata · JSON-LD · Analytics
│   ├── robots.ts · sitemap.ts · manifest.ts · icon.svg
│   └── page.tsx                  the one-page game
├── components/
│   ├── cube/RubiksCube.tsx       3D engine (r3f pivot-group turns)
│   ├── cube/CubeStage.tsx        canvas, lights, camera
│   ├── legal.tsx                 consent · privacy · disclaimer
│   ├── ErrorBoundary.tsx         localStorage corruption shield
│   └── Logo.tsx
├── lib/
│   ├── cube.ts                   move alphabet (validate · invert · simplify)
│   ├── cubie.ts                  cubie state model (perm + orientation)
│   ├── solve-kociemba.ts         ⚡ superhuman solver + reference verification
│   ├── store.ts                  XP · badges · run stats (persisted)
│   └── memes.ts                  tier banks · roasts · ranks
└── server/
    └── jev-engine.ts             🔒 single engine choke point (server-only)

🙏 Credits

  • Cube model adapted from buuing/Rubiks-Cube — the most-starred Three.js Rubik's cube.
  • Font vibes from Bruno Simon's portfolio (Amatic SC + Nunito).
  • Judgments by Jev via the TypeSafe System One API — probabilistic, for fun, never a fact.

🫡 Author

Trou · 0xtrou

the one who taught Jev to cook 👨‍🍳

GitHub X

enjoyed the chaos? drop a ⭐ — Jev counts the stars too

⚠️ Disclaimer

Fan-made demo, provided as is, for entertainment only. Not affiliated with Rubik's Brand Ltd or Spin Master Ltd — "Rubik's Cube" is a trademark of its respective owner; this project simulates a classic 3×3 twisty puzzle. AI output is probabilistic and may be inaccurate. Scores and XP have no value outside this site. See the in-app Disclaimer, Privacy & Cookies, and Experimental Notice for the full text.


🗿 scramble. cook. gamble. we move.

— Trou · 0xtrou · @_trou3

About

Challenge the Jev's intelligence in Rubik Cube puzzles

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages