How danielenapo/rubik-s-cube-solver works
Project type and purpose
• This is a standalone full-client Android application whose responsibilities are:
– Capturing cube face images via camera (OpenCV)
– Computing optimal solution moves (Kociemba’s algorithm via min2phase)
– Rendering a 3D animated cube and step-by-step moves (OpenGL/Android views)
File structure
• app/ – Android application module
– src/main/java/cs/min2phase → solver engine (CoordCube, Search, Tools)
– src/main/java/com/example/mostraMosse → 3D cube model, renderer, view, UI activities
– src/main/java/com/example/menu & Instructions → launch screens, menus
– src/main/cpp & jniLibs → native stubs and prebuilt OpenCV native libs for image processing
• java/ – OpenCV SDK module
– src/main/java/org/opencv → wrappers & AIDL interfaces for OpenCV camera and image-processing APIs
README for insights
• Technologies: OpenCV (Java + native), OpenGL ES (Android GLWorld/CubeRenderer), Kociemba’s algorithm, Android SDK
Main components & relationships
A. Camera & Capture Layer
– Android Camera API (JavaCameraView)
– OpenCVLoader & BaseLoaderCallback
– AsyncServiceHelper (initialization)
→ feeds frames to →
B. Scanner Module
– Scanner.java & Square.java
→ passes ‘state’ to →
C. Solver Engine
– min2phase.Search & CoordCube/CubieCube
– Tools & Util for move sequence generation
– Outputs ordered list of moves (e.g. “R U R’ U’…”)
→ sends moves to →
D. Visualization Module
– GLWorld, CubeRenderer, CubeView
– RubeCube, CubeSide, Layer data models
– DragThread for user interaction
– MostraMosseActivity / MostraMosseApp UI
E. Menu & Navigation
– Menu.java, Instructions.java
– Launch flow: Menu → ScannerActivity → Solver→ VisualizationActivity
F. External Dependencies (outside Android APK)
– OpenCV native libs (.so in jniLibs)
– OpenCV AIDL service (OpenCVEngineInterface)
Architectural patterns
• Modular layering: capture → processing → business logic → presentation
• MVC-style separation in visualization module: data (RubeCube) vs. view (CubeView) vs. controller (DragThread)
• Native/Java boundary: OpenCV native libs ↔ Java wrappers (via JNI/AIDL)
Detail without over-fragmenting
• Logical modules above
• Inside each module, you may list key classes in small font
• Do not break down into individual utility classes (e.g., Converters, Util), unless they play a major architectural role