comparisons

~/tests/cubo-magico

3D Rubik's cube simulator in a single HTML file

A 3x3x3 cube in WebGL with Three.js, in a single file with inline CSS and JavaScript. The brief asks for animated layer rotation that never corrupts cube state, the full standard notation (U/D/L/R/F/B with ' and 2), scramble, undo and reset, a move counter, a timer, and both keyboard and button controls. Layer rotation is where the runs diverge most: reparenting cubies onto a pivot and handing them back without accumulating floating-point drift is not trivial.

3 runs3 models
  • html
  • javascript
  • three-js
  • 3d
  • webgl
  • puzzle
  • arquivo-unico

challenge prompt

Crie um simulador de cubo magico 3D em um unico arquivo HTML.

Requisitos funcionais:
- Cubo 3x3x3 renderizado em 3D com Three.js, com as seis cores nas faces
- Rotacao animada de camadas, uma camada por vez, sem quebrar o estado do cubo
- Notacao padrao (U, D, L, R, F, B) com as variantes ' (anti-horario) e 2 (meia volta)
- Botoes de embaralhar, desfazer o ultimo movimento e resetar
- Contador de movimentos e cronometro
- Controle por teclado e por botoes na tela
- Camera orbital com o mouse (arrastar para girar, scroll para zoom)

Restricoes tecnicas (obrigatorias):
- UM unico arquivo index.html. Todo o CSS e todo o JavaScript inline. Nao crie nenhum outro arquivo
- Three.js vem do CDN, declarado num <script type="importmap"> inline e consumido por um <script type="module"> tambem inline:

  <script type="importmap">
  {"imports":{
    "three":"https://cdn.jsdelivr.net/npm/three@0.180.0/build/three.module.js",
    "three/addons/":"https://cdn.jsdelivr.net/npm/three@0.180.0/examples/jsm/"
  }}
  </script>
  <script type="module">
  import * as THREE from 'three';
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
  </script>

  Atencao: importar https://cdn.jsdelivr.net/npm/three@0.180.0/examples/jsm/controls/OrbitControls.js pela URL direta NAO funciona — esse arquivo faz `import ... from 'three'`, e o especificador bare so resolve pelo importmap
- NAO use <script type="module" src="..."> apontando para arquivo local
- NAO use localStorage nem sessionStorage — eles lancam SecurityError no ambiente onde a pagina roda
- A pagina roda dentro de um iframe sandbox de origem opaca: sem cookies, sem acesso a janela pai
- Deve caber e ficar legivel em 1440x900

metadata side by side

3 runs

These numbers describe what each run generated. They are not a score or rank.

metadata side by side
model harness author files lines duration author's rating
Claude Haiku 4.5 Claude Code Web Leonardo 1 530 ~2min
Claude Opus 5 Claude Code Web Leonardo 1 788 ~9min
Claude Sonnet 5 Claude Code Web Leonardo 1 759 ~6min

runs on this challenge

3 models