Vibe Coding a Rubik's Cube Solver with Three.js – A Late Entry to LevelsIO Competition

May 28, 2025 (Today)

I had never used Three.js before.

Honestly, I didn't even know Three.js existed until recently (sorry!). It turns out it's a straightforward 3D rendering engine running directly in your browser—which, to me, is already a huge win. At one point, I used to run a CGI company, so 3D concepts weren't totally foreign. That experience was great, but I used none of that. And I intentionally didn't learn Three.js. Instead, my goal was a pure vibe-coded AI build, making this challenge more exciting than practically stupid.


Starting Out – The Cubeventure

I had no idea what game to build. For god's sake, I love games. But never in my history have I considered actually making one. Where do you even start? Then, looking at my desk, inspiration struck—I need to make a digital copy of my Rubik's Cube but cooler.

As a Hungarian, the Rubik's Cube holds a special place in my life (Erno Rubik, its inventor, is Hungarian!). Within two hours, I had a basic 3D cube model—no rotations yet, just a cube—but it was there in my browser. (I WAS WINNING!)

Soon I had the first rotation going. Ugly or not, it fucking worked! But then my positive attitude started hitting a wall, and oh boy, did AI screw things up. Rendering faces became an absolute nightmare. I spent the next day fighting bugs, endlessly backtracking without success.


Research? What Research?

Turns out, I hadn't bothered to Google my problem. I went straight to build, and since I started with a big win, I never felt I needed to. When I did, I realized countless Rubik's Cube libraries already existed (duh). Cue a night spent ranting to my partner about my stupidity—building first and researching later clearly wasn't smart.

Clarity returned: why reinvent the wheel? I decided to "just" integrate an existing library, cubing.js, and focus instead on improving visuals and functionality.

Then, as soon as I integrated cube.js... I went further down the rings of hell to the eternal depth of prompt hell.


Cube.js and the LLM Nightmare

Cube.js is powerful. It is actually a magical library, and congrats to Idez for the build (https://github.com/ldez/cubejs). It's specifically built for cubers—handling cube states, rotations, scrambles, and algorithms effortlessly. But with its power came complexity.

Reality hit hard: supposedly almighty LLMs deeply failed to handle the intricate orientation logic of Cube.js. Oh boy, we truly lost the plot.

I restarted four times. From scratch. Totally. From. The. Start. We're talking about clean repos, zero reused code—yet faced a consistent issue:

  • Face misalignments: After certain rotations, stickers flipped, mirrored, or became completely misplaced. ("Stickers" are Cubing.js's naming convention for the colorful faces of a Rubik's Cube.)

Methodical Failure

I tried DeepSeek V3 and R1, Cursor 3.5 and 3.7 with thinking, Grok, and even ChatGPT. All provided plenty of initial ideas with accompanying code, but none could reliably manage face directions once complexity increased. Cube.js implementations never got beyond the most basic cube without immediate breakdown.

The idea of outsourcing the solving algo to Cube.js? I wanted to focus on a visually explosive effect—particles exploding apart and reassembling with new sticker colors instead of standard rotations. A cool UI idea, but practically ensured nothing ever worked.

This truly infuriating process consumed days, cycling through approaches and undoing edits without progress. And trust me, I tried every prompting trick imaginable.


The Miracle: Gemini 2.5 Pro

At my lowest, Google dropped Gemini 2.5 Pro. Reluctantly, I gave it one final shot—without Cube.js.

Against all odds—it worked. IT WORKED!!! Gemini 2.5 Pro grasped the cube logic immediately and translated it reliably into clean, stable code. Later, we even made it work on mobile. Check it out at cube.nembal.com.


How Did We Do It?

  • Did I finish this for LevelsIO's Threes game competition? No—I was off by two days.
  • Did I build exactly what I planned? Hell no. I wanted particle explosions instead of rotations and a cube solver (take a photo → auto-setup → solve steps).
  • Am I still happy? 100% yes.

The true power is in doing it and learning from the mistakes along the way.


Learnings from the Process

1. Start with a Discussion

  • Oral or written—doesn't matter. Understand your options and potential steps.
  • Build complexity gradually. Don't start with "I want to build a Death Star." Instead:
    • "Let's build a hypermatter reactor."
    • "Now, add a 160km diameter casing."
    • "Then, add levels, offices, and living quarters for 2M personnel."
    • "Next, thousands of hangars, TIE fighter bays, and capital ship docks."
    • "Finally, a 35km superlaser powered by kyber crystals."
Build

The goal? Understand the direction early—but don't overwhelm the LLM upfront. This forces you to think things through clearly before diving into prompts.

2. Build a Junky MVP

  • Make it barely functional in a new thread (or using Cursor).
  • Test multiple AI tools briefly—some handle tasks better than others.
  • This helps you see potentials and limitations before deep diving.

3. Layer Complexity Gradually

  • Keep related docs in shared folders.
  • Too many files or repos? The LLM loses focus, overcomplicates things, or re-solves already-solved problems.

4. Craft Better Prompts

  • "Fix this" feels good, but specificity wins.
  • Explain the problem in an online chat first → get a simplified PRD (text or low-code).
  • This reduces hallucinations and helps the AI align with your expected solution.

5. Vibe Coding ≠ No Expectations

  • AI can code for you, but you set the standards.
  • "Make it better" works… until it doesn't. (Though it's fun—try it!)

TL;DR: The Process

  1. Pick a topic you care about.
  2. Build it.
    • Most MVPs are within AI's scope. If not, your MVP is too complex.

Coding today ≠ coding three years ago. Your job? Ensure the piping works—let the AI do the heavy lifting.

We're still X years away (insert your preferred time window) from fully AI-built services. Learn these tools now—businesses will run on them sooner than you think.


Buckle up and play with my cube: cube.nembal.com
Tips/tricks? Find me @nembal on X.

Cube

Links: