main.py (CLI entry point)
βββ config.py (configuration loading)
βββ manual_mode.py
β βββ cube_engine.py (cube state)
β βββ moves.py (move execution)
β βββ parser.py (notation parsing)
β βββ renderer.py (3D rendering)
β βββ input_handler.py (keyboard input)
β βββ solver.py (kociemba integration)
β βββ utils.py (terminal utilities)
βββ auto_mode.py
βββ cube_engine.py
βββ moves.py
βββ renderer.py
βββ utils.py
Core cube state: dictionary mapping face names to 9-element sticker arrays.
Provides solved-state factory, is_solved(), state copy/load, move history
tracking (undo/redo stacks), and scramble generation.
All 18 face moves (R/L/U/D/F/B Γ CW/CCW/double) and 6 cube rotations
(x/y/z Γ both directions). Each move mutates sticker arrays in-place via
direct index permutations. Includes dispatch table, inverse lookup, and
undo()/redo() functions.
Parses space-separated cube notation strings into validated token lists. Handles Unicode prime characters and provides clear error messages.
Two rendering modes:
- 3D Isometric: Shows top, front, and right faces with brightness-based depth shading using ANSI truecolour backgrounds.
Also renders: animated pyfiglet banner, live status bar, full frame composer.
TOML configuration with layered priority (CLI > local file > global file >
defaults). Uses tomllib (3.11+) with tomli fallback. Provides the
rubui init config file generator.
Cross-platform raw keyboard input (msvcrt on Windows, termios on Unix). Key-to-move mapping, 350ms double-turn detection, integrated command prompt mode, and special key handling.
Main interactive game loop: render β read input β animate move β repeat. Includes animated startup banner, live status bar, help overlay, command prompt, and clean terminal lifecycle management.
Converts the current cube state into Kociemba facelet order (URFDLB) and
invokes the kociemba package to return a move sequence that solves the cube.
Screensaver mode: picks random moves at configurable speed, renders continuously, responds to quit/mode-switch.
Terminal primitives: ANSI support detection (with Windows VT processing enablement), cursor/screen control, RGB colour helpers, theme definitions (dark/light/monochrome), frame timer, and time formatting.