How yogendra095/sudoku_cpp works
Project Type and Purpose
• This is a monolithic, native C++ desktop application: a Sudoku game built on top of the SFML 3.0.0 multimedia library.
• The README confirms compilation and runtime steps, showing dependencies on SFML’s graphics, window, system, and audio modules.
File‐Structure Analysis
• Top‐Level
• SFML‐3.0.0/ – local copy of the SFML SDK (includes headers, libs, docs, examples)
• Src/ – application source and assets
• Readme.md, Proposal.pdf, .gitignore
• Src/
• main.cpp → application entry point & state machine
• login.cpp/.hpp → authentication logic (reads/writes users.txt)
• Menu.cpp/.hpp, LevelSelection.cpp/.hpp → UI screens
• SudokuGame.cpp/.hpp → core puzzle logic
• User.cpp/.hpp → user model & persistence via users.txt
• assets/fonts, assets/images → static resource files
Key Insights from README
• Uses g++ to compile all CPP files in Src/, linking against SFML libraries via ‑I (include) and ‑L (lib) flags.
• Runtime is a single executable that opens an SFML RenderWindow and drives the game loop.
Main Architectural Components
A. Presentation Layer (UI Screens)
• MenuView, LevelSelectionView, GameView
• Invokes SFML Window and Graphics APIs for rendering and event handling
B. Controller / Application Layer
• main.cpp orchestrates initialization, screen transitions, and game loop
• Routes SFML events (keyboard/mouse) to the active View
C. Domain / Business Logic
• SudokuGame: puzzle generation, validation, game state
• User: model of player data (name, progress)
D. Data Access Layer
• UserManager (within login.cpp/User.cpp): reads/writes users.txt on disk
• ResourceManager: loads fonts/images from assets/ into SFML Textures, Fonts
E. External Libraries
• SFML modules: Window, Graphics, System, Audio
• Underlying OS (display, input, file system)
Relationships & Data Flow
• User → SFML Event → Application Controller → Active View
• View → calls Game Logic API (e.g., SudokuGame::checkMove())
• Game Logic → updates Domain Model (User progress)
• Domain Model → persists via Data Access (users.txt)
• Views & Logic → request resources via ResourceManager → SFML loads from disk
Architectural Patterns & Principles
• Layered architecture: clear separation of UI, application flow, domain logic, and data persistence
• Single Responsibility: each class/file addresses exactly one concern
• Dependency direction: higher layers depend on lower-level SFML/OS, not vice versa
Step-by-Step Guidance for the Engineer
1. Sketch the outer process boundary (“SudokuGame.exe”).