Educational CPU-rendered Rubik cube prototype.
Features:
- pure Python 3D math and software rasterization
- PyQt6 window only displays CPU framebuffer
- Rubik cube face turns with keyboard
- agent CLI over Unix socket
- LLM-safe CLI for text-state solving experiments
- headless control tests
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtSystem package note: PyQt6 must work on your desktop session.
python3 cpu3d_cube.pyKeyboard:
WASD/ arrows — rotate viewQ/E— roll view1— L2— U3— R4— F5— B6— DShift + 1..6— inverse move7— reverse mode on/off8— undo one recorded move9— scramble0— resetEsc— quit
General CLI. Useful for automation and demos.
python3 rubik_cli.py find
python3 rubik_cli.py ping
python3 rubik_cli.py status
python3 rubik_cli.py state
python3 rubik_cli.py key 1 2 3
python3 rubik_cli.py seq "R U R' U'"
python3 rubik_cli.py hold d 0.5
python3 rubik_cli.py scramble
python3 rubik_cli.py solve
python3 rubik_cli.py resetRestricted CLI for honest LLM solving tests.
Allowed:
python3 rubik_llm_cli.py state
python3 rubik_llm_cli.py move R
python3 rubik_llm_cli.py move "R'"
python3 rubik_llm_cli.py seq R U "R'" "U'"
python3 rubik_llm_cli.py checkNot exposed:
- reset
- scramble
- solve/undo
- history
- internal state
Move mapping:
L U R F B D- suffix
'for inverse - suffix
2for double turn
Phone-key mapping inside app/general CLI:
1=L2=U3=R4=F5=B6=D
See llm_rubik_manual.md for state format and test protocol.
QT_QPA_PLATFORM=offscreen python3 test_controls.pyExpected:
controls ok
cpu3d_cube.py— PyQt6 app, CPU renderer, Rubik model, Unix socket control serverrubik_cli.py— full agent CLI, socket-first, xdotool fallbackrubik_llm_cli.py— restricted CLI for LLM experimentstest_controls.py— headless smoke testsllm_rubik_manual.md— fair-test protocol
Rendering path:
- cubie stickers as 3D quads
- optional animated layer rotation
- camera rotation
- perspective projection
- painter's algorithm
- scanline quad fill into low-res framebuffer
- PyQt6 scales framebuffer to window
This is a desktop teaching prototype, not a phone build. The math/rendering approach can be ported to Java ME with fixed-point math, lookup sin/cos tables, and low-resolution drawing.
MIT