A Case Study in Human-AI Collaborative Software Development
- What Is This Project?
- The AI Development Story
- Quick Start
- Features
- Architecture
- What We Learned
- Development Journey
- Technical Details
- Contributing
- License
This is a fully-functional Rubik's Cube solver with three different interfaces (command-line, web, and desktop), built entirely through conversation with Claude Code, Anthropic's AI coding assistant.
The goal? To explore what's possible when humans and AI collaborate on complex software development, and to document the process so others can learn from it.
- 100% of code generated by AI (Claude Code)
- Zero lines written directly by human (except this README update!)
- Complete working application with 3D visualization, solving algorithms, and multiple UIs
- Full documentation of every prompt, decision, and iteration
- Production-quality code meeting professional standards (9.07/10 pylint score, 28 passing tests)
This project serves as a real-world case study for:
- What LLMs can do well (and where they struggle)
- How to effectively guide AI coding assistants
- The balance between AI capability and human direction
- Building production-quality software through natural language
✅ Algorithm Implementation
- Claude Code successfully implemented complex cube mechanics using matrix transformations
- Built a plugin-based solver architecture with IDDFS (Iterative Deepening Depth-First Search)
- Created accurate 3D visualizations using Three.js and OpenGL
✅ Multiple UI Paradigms
- Command-line interface with ANSI colors and interactive REPL
- Web interface with real-time WebSocket communication
- Desktop application with hardware-accelerated OpenGL rendering
✅ Code Quality & Testing
- 28 comprehensive unit and integration tests (all passing)
- Consistent 9.0+ pylint scores throughout development
- Clean architecture with proper separation of concerns
✅ Documentation
- Self-documenting code with comprehensive docstrings
- Detailed inline comments explaining complex logic
- Configuration files with explanatory headers
🧠 Architecture Decisions
- Choosing the plugin-based solver system
- Deciding on the hybrid face-clicking + camera-dragging interaction model
- Structuring the project into phases (Core → Solver → CLI → Web → Desktop)
🧠 Problem-Solving
- Debugging cube rotation mechanics (initial implementation had incorrect edge cycling)
- Fixing animation timing issues (colors updating before vs. after animations)
- Resolving OpenGL context issues with face click detection
🧠 UX Design
- Making the desktop app non-blocking by moving solver to background thread
- Implementing "smart drag detection" to distinguish clicks from camera movements
- Choosing accessible color contrasts (WCAG AA compliance)
❌ Initial Cube Implementation
- First attempt at cube moves had incorrect edge cycling for 5 out of 6 moves
- Required complete rewrite following proven matrix transformation approach
- Lesson: Start with proven approaches for complex algorithms
❌ Animation Synchronization
- Multiple attempts needed to get cube colors updating at the right time during animations
- Issue: Understanding when to save state (before move) vs. when to animate (after move)
- Lesson: State management in animations requires careful sequencing
❌ Face Click Detection
- Initial OpenGL picking implementation caused GLError (invalid operation)
- Root cause: Calling glReadPixels outside rendering context
- Lesson: Framework constraints (like OpenGL contexts) need explicit handling
Development followed an incremental, phase-based approach:
- Phase 1: Core cube mechanics (505 lines, 32 tests)
- Phase 2: Solver system with plugin architecture (664 lines)
- Phase 3: CLI interface with colored terminal (650+ lines)
- Phase 4: Web interface with 3D visualization
- Phase 5: Desktop application with OpenGL rendering
Each phase was completed 100% before moving to the next. When bugs were found, we went back and fixed them properly rather than moving forward with technical debt.
You need Python installed. Here's how to check and install:
# Check if Python is installed (need 3.11 or higher)
python3 --version
# If not installed:
# - macOS: Install from python.org or use `brew install python3`
# - Linux: `sudo apt install python3` or `sudo yum install python3`
# - Windows: Download from python.org and run installerThe easiest way: Use the launcher script
# Clone the repository
git clone https://github.com/daniel-pittman/rubiks-cube-solver.git
cd rubiks-cube-solver
# Run the launcher (handles everything automatically!)
./run_app.shThe launcher will:
- Create a Python virtual environment
- Install all dependencies
- Show you a menu to choose which interface to run
Menu options:
- CLI - Command-line interface with colored cube display
- Web - Flask server with 3D visualization (opens browser to localhost:5000)
- Desktop - PySide6 application with OpenGL 3D rendering
- Tests - Run all 28 unit tests to verify everything works
# Create virtual environment
python3 -m venv venv
# Activate it
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run specific interface
python -m solver.cli # Command-line
python -m solver.flask_app # Web (then open localhost:5000)
python -m solver.desktop_app # Desktop GUI- Accurate Cube Mechanics: Matrix-based state using proven transformation approach
- IDDFS Solver: Finds optimal solutions for scrambled cubes (depth 5-8)
- Plugin Architecture: Extensible solver system for future algorithms
- Move Notation: Standard Western notation (R, L, U, D, F, B, primes, doubles)
- State Management: Save and restore scrambled states for solution replay
> scramble 5
🎲 Scrambling cube with 5 moves...
Moves: R U' F D L
> solve
🧠 Solving cube...
Solution found: L' D' F' U R'
[Step-by-step playback with colored visualization]
> help
[Comprehensive interactive help system]
Features:
- Colored ANSI terminal output (cross-platform)
- Interactive REPL with command history
- Manual move execution or sequence input
- Step-by-step solution visualization
- Undo/redo functionality
Launch: python -m solver.flask_app → Open http://localhost:5000
Interactive 3D Controls:
- Left-click face: Clockwise rotation
- Right-click face: Counter-clockwise
- Ctrl/Cmd+Click: 180° rotation
- Drag background: Rotate camera view
- Scroll: Zoom in/out
- Auto-rotate button: Continuous rotation for viewing
- Reset camera: Return to default angle
Features:
- Real-time 3D cube with Three.js
- Smart drag detection (knows click vs drag)
- Live move history panel
- Solution generation and playback
- Save/restore scrambled states
- WebSocket real-time updates
- Mobile-responsive touch controls
Launch: python -m solver.desktop_app
Features:
- Hardware-accelerated OpenGL rendering
- Interactive face clicking (same controls as web)
- Smooth rotation animations with easing
- Background solver thread (UI stays responsive)
- Solution playback dialog with manual controls
- Camera orbit controls
solver/
├── core/ # Core cube logic
│ ├── cube.py # Cube implementation (505 lines)
│ ├── solver.py # Solver interface (186 lines)
│ ├── solvers/ # Plugin system
│ │ ├── base_solver.py # Abstract base (232 lines)
│ │ └── iddfs_solver.py # IDDFS algorithm (246 lines)
│ └── tests/ # 28 unit tests
│ ├── test_cube.py
│ ├── test_cube_comprehensive.py
│ └── test_scramble.py
├── cli/ # Command-line interface
│ ├── cli_app.py # Interactive CLI (650+ lines)
│ └── __main__.py # Entry point
├── web/ # Web interface
│ ├── static/
│ │ ├── css/styles.css # Responsive styling
│ │ └── js/
│ │ ├── cube3d.js # Three.js visualization
│ │ ├── socket-client.js # WebSocket sync
│ │ ├── ui-controls.js # Interactive controls
│ │ └── app.js # Main app logic
│ └── templates/
│ └── index.html # Single-page app
├── desktop/ # Desktop application
│ ├── cube_gl_widget.py # OpenGL 3D widget
│ └── __init__.py
├── flask_app.py # Flask + SocketIO server
├── desktop_app.py # PySide6 main window
└── tests/ # Integration tests
└── test_solver_integration.py
| Component | Technology |
|---|---|
| Backend | Python 3.11+, Flask, Flask-SocketIO |
| Frontend | Vanilla JavaScript, Three.js, Socket.IO |
| Desktop | PySide6 (Qt6), PyOpenGL |
| Core Logic | NumPy for array operations |
| Testing | pytest (28 tests, 100% pass rate) |
| Code Quality | black, isort, autoflake, pylint (9.07/10) |
| Version Control | Git with pre-commit hooks |
- Plugin Architecture: Solvers register themselves; runtime selection
- State Preservation: Save cube state before solving for replay
- Event-Driven UI: WebSocket for web, Qt signals for desktop
- Hybrid Interaction: Seamless blending of face clicks + camera controls
- Background Processing: Threading for solver to keep UI responsive
LLMs Excel At:
- Implementing well-defined algorithms from specifications
- Generating boilerplate and repetitive code structures
- Writing comprehensive tests and documentation
- Following consistent code styles and patterns
- Applying design patterns (plugins, facades, etc.)
Humans Are Essential For:
- High-level architecture decisions
- Debugging subtle interaction issues
- UX design and accessibility considerations
- Recognizing when to restart vs. iterate
- Deciding when "good enough" is actually good enough
The Sweet Spot:
- Human provides vision, direction, and judgment
- AI implements, tests, and documents
- Human reviews, guides refinement, and maintains quality bar
- Iterative back-and-forth until solution emerges
Technical Insights:
- Matrix transformations are cleaner than position tracking
- Edge cycling is the tricky part (not face rotation)
- IDDFS works well for small scrambles (5-8 moves)
- State explosion makes depth >10 impractical without heuristics
- Animation timing requires careful state management
UX Insights:
- Hybrid click+drag mode feels more natural than mode switching
- Accessibility (color contrast, keyboard support) matters
- Background processing is critical for complex solvers
- Solution playback needs manual controls, not just auto-play
This project was built through ~300+ conversational exchanges over several sessions. Key milestones:
- Initial attempt had incorrect edge cycling
- Complete rewrite using matrix transformation approach
- 32 unit tests, all moves validated mathematically
- Learning: Start with proven approaches for complex algorithms
- Designed plugin architecture for extensibility
- Implemented IDDFS optimal solver
- Created solver registry and auto-selection
- Learning: Good architecture pays off later
- Rich terminal UI with ANSI colors
- Interactive REPL with command history
- Cross-platform compatibility handling
- Learning: User experience matters even in CLI
- Multiple iterations on interaction model
- Discovered hybrid click+drag approach
- Fixed animation synchronization issues
- Learning: UX iteration is essential, even with AI
- Implemented hardware-accelerated OpenGL rendering
- Solved UI freezing with background threads
- Fixed OpenGL context issues with face clicking
- Learning: Framework constraints require explicit handling
- Scramble Reveal: Show scramble sequence in competition format
- Copy to clipboard functionality
- Spoiler text in move log (click-to-reveal)
- Responsive design refinements
- Learning: Rapid feature iteration based on user feedback
Complete development log: See conversation_summary/ for every prompt and response organized by phase.
Uses 3D NumPy array: stickers[6 faces][3 rows][3 columns]
# Each face is a 3x3 grid of colors
stickers[Face.U] = [[W, W, W],
[W, W, W],
[W, W, W]]Color Scheme (Western/WCA standard):
- White (U) ↔ Yellow (D)
- Red (R) ↔ Orange (L)
- Green (F) ↔ Blue (B)
Standard notation: R, L, U, D, F, B
- Prime (
'): Counter-clockwise - Double (
2): 180°
Implementation:
- Rotate the face itself (
np.rot90) - Cycle edge pieces between adjacent faces
- Reverse appropriate edges for correct orientation
Algorithm: Iterative Deepening Depth-First Search
- Searches depth 1, then 2, then 3, etc.
- Guarantees optimal solution (fewest moves)
- Practical limit: depth 8 (~5-10 seconds)
Optimization: Prunes redundant moves (e.g., no R after R')
Client-Server Communication:
Browser (Three.js) ←→ SocketIO ←→ Flask ←→ Cube Core
State Sync:
- User action (click, scramble, solve)
- Client emits WebSocket event
- Server updates cube state
- Server broadcasts state to all clients
- Clients update 3D visualization
28 Tests covering:
- Individual move correctness (6 tests)
- Mathematical properties (3 tests)
- Scramble validity (7 tests)
- Solver integration (6 tests)
- Edge cases (6 tests)
Run tests: ./run_app.sh → Select option 4
This project welcomes contributions! Areas of interest:
- Additional Solvers: Implement A*, IDA*, or Kociemba's algorithm
- Performance: Optimize IDDFS with pattern databases
- Features: Cube timer, move counter, solution comparison
- UI/UX: Improved animations, themes, tutorials
- Fork the repository
- Create a feature branch
- Make your changes
- Run
./run_python_formatters.sh(must score ≥9.0/10) - Run tests:
pytest solver/ -v - Submit pull request
Code Standards:
- Black formatting (auto-applied)
- Pylint score ≥9.0
- Type hints where helpful
- Comprehensive docstrings
- Unit tests for new functionality
- CLAUDE.md: Instructions for continuing development with Claude Code
- DEVELOPMENT_JOURNAL.md: Retrospective from Claude's perspective with technical architecture and lessons learned
- conversation_summary/: Complete conversation history organized by development phase
MIT License - See LICENSE for details
Copyright (c) 2025 Daniel Pittman
- MagicCube (github.com/trincaog/magiccube): Reference for cube mechanics
- Three.js: 3D visualization library
- Flask & Socket.IO: Real-time web framework
- PySide6: Qt6 Python bindings
- Anthropic: Claude Code AI coding assistant
This project demonstrates that LLMs can build production-quality software when given proper guidance. But it's not magic—it's collaboration.
What surprised us:
- How quickly complex features came together with good prompts
- The importance of incremental development (don't skip phases!)
- How much human judgment matters for architecture and UX
- That AI-generated code can meet professional quality standards
What we'd do differently:
- Start with even more research on cube mechanics
- Build a test suite before implementing features
- Document architectural decisions as we make them
- Create a git branching strategy earlier
The bottom line: AI coding assistants are powerful tools that amplify human developers, not replace them. The human provides vision, judgment, and direction. The AI provides implementation speed, consistency, and tireless iteration.
Built through conversation between 🧠 Human Guidance + 🤖 Claude Code
Want to see the complete development conversation? Check out conversation_summary/