How rizkyyanuark/sudoku-puzzle-solver works
Main Components
• Frontend/UI:
• Represented by files like index.html, static/styles.css, and the JavaScript in js/scripts.js.
• This component is responsible for capturing user inputs (image upload/camera capture) and displaying results (original, processed image, and solved board).
• Backend/Server:
• Centered around the Flask application in app.py.
• Acts as the mediator between the frontend and the processing logic.
• Processing & Utility Modules:
• Found in the util directory (main.py, process.py, sudoku_solver.py) which house the image processing routines (using OpenCV), puzzle processing, and the solving algorithm.
• Machine Learning Model:
• Contained within the models folder (my_model.h5) and used for digit recognition from the processed images.
• Additional Documentation & Resources:
• The Classification directory with educational materials (a PDF and notebook) and the material folder containing images (sudoku.png) and demo content.
• Deployment & Configuration:
• Files such as Dockerfile, .dockerignore, cloudbuild.yaml, and the requirements.txt indicate how the system is containerized and built.
Relationships and Data Flow
• User → Frontend: Users interact with the index.html UI by uploading an image or using the camera.
• Frontend → Backend (app.py): The client (via HTML/JS) sends image data to the Flask server.
• Backend → Utility Functions:
• The server calls functions in util/process.py to perform image pre-processing (e.g., grid detection).
• It then uses util/sudoku_solver.py for the puzzle solving logic (backtracking algorithm).
• Backend → ML Model: During processing, the backend loads the CNN model from models/my_model.h5 to perform digit recognition.
• Backend → Frontend: After processing and solving, the server sends back the processed images and results for display.
• Deployment: Dockerfile, cloudbuild.yaml, and related configs indicate containerization and cloud build steps.
Architectural Patterns & Technologies
• MVC or Layered Architecture: The frontend (View) is separated from the backend logic (Controller/Model), while utility modules encapsulate domain-specific logic.
• Full-Stack Separation: Clearly separate client-side interactions from server-side processing.
• Integration of Image Processing and ML: Represent the flow where the image is pre-processed and then fed into the ML model followed by puzzle-solving – demonstrating the sequential pipeline design.
Detailed Step-by-Step Approach for the Engineer
a. Start by mapping out the client side:
• That this layer handles the user interface and interaction.
• App.py and indicate how it receives requests from the UI.
c. Break out the processing modules:
d. “Deployment & Configuration” area:
• Dockerfile, cloudbuild.yaml, and related config files to indicate containerization and continuous delivery setup.