# akkovaleva14/sudoku architecture

> Architecture diagram of the GitHub repository akkovaleva14/sudoku, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akkovaleva14/sudoku
- Repository: https://github.com/akkovaleva14/sudoku

## Overview

Sudoku is an offline Android game. The player starts or resumes a puzzle, enters moves and uses hints, then completes or loses the game; results are kept in a local history. The README documents generation, difficulty evaluation, game rules, hints, persistence, results, and presentation capabilities. Source excerpts were not provided, so relationships between implementation components are conservative and marked unverified where the README does not establish the wiring.

Main entry points: [`app/src/main/java/com/example/sudoku/presentation/game/GameFragment.kt`](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/game/GameFragment.kt) (Game screen), [`app/src/main/java/com/example/sudoku/presentation/main/MainActivity.kt`](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/main/MainActivity.kt) (Navigation), [`app/src/main/java/com/example/sudoku/presentation/shared/state/SudokuViewModel.kt`](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/shared/state/SudokuViewModel.kt) (Game state), [`app/src/main/java/com/example/sudoku/domain/game/GameEngine.kt`](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/game/GameEngine.kt) (Game engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["App presentation"]
  node_application["Application"]
  node_main["Navigation<br/>[MainActivity.kt]"]
  node_start["Start screen<br/>[StartFragment.kt]"]
  node_game_screen["Game screen<br/>[GameFragment.kt]"]
  node_board["Sudoku board<br/>[SudokuBoardView.kt]"]
  node_viewmodel["Game state<br/>[SudokuViewModel.kt]"]
  node_ui_state["UI state<br/>[SudokuUiState.kt]"]
  node_results_screen["Results screen<br/>[ResultsFragment.kt]"]
  node_effects["Game effects"]
end

subgraph group_gameplay["Gameplay domain"]
  node_game_engine["Game engine<br/>[GameEngine.kt]"]
  node_rules["Sudoku rules<br/>[SudokuRules.kt]"]
  node_hints["Hint analysis<br/>[HintAnalyzer.kt]"]
  node_game_model["Game model<br/>[SudokuGame.kt]"]
end

subgraph group_generation["Puzzle generation"]
  node_generate_use_case["Puzzle generation"]
  node_generator["Puzzle generator"]
  node_difficulty["Difficulty evaluator"]
end

subgraph group_storage["Local data"]
  node_game_repository["Game repository<br/>[GameRepository.kt]"]
  node_preferences[("Saved game store")]
  node_codec["Game JSON codec<br/>[SudokuJsonCodec.kt]"]
  node_results_repository["Results repository"]
end

node_player(("Player"))

node_player -->|"starts game"| node_start
node_player -->|"plays puzzle"| node_game_screen
node_player -->|"views history"| node_results_screen
node_application -.->|"launches"| node_main
node_main -.->|"navigates"| node_start
node_main -.->|"navigates"| node_game_screen
node_main -.->|"navigates"| node_results_screen
node_game_screen -.->|"displays"| node_board
node_game_screen -.->|"uses"| node_viewmodel
node_viewmodel -.->|"updates"| node_ui_state
node_viewmodel -.->|"delegates"| node_game_engine
node_game_engine -.->|"checks rules"| node_rules
node_game_engine -.->|"requests hints"| node_hints
node_game_engine -.->|"updates"| node_game_model
node_start -.->|"requests puzzle"| node_generate_use_case
node_generate_use_case -.->|"generates"| node_generator
node_generate_use_case -.->|"evaluates difficulty"| node_difficulty
node_viewmodel -.->|"saves game"| node_game_repository
node_game_repository -.->|"stores locally"| node_preferences
node_preferences -.->|"encodes data"| node_codec
node_results_screen -.->|"loads history"| node_results_repository
node_game_screen -.->|"shows outcome"| node_effects

click node_application "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/SudokuApplication.kt"
click node_main "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/main/MainActivity.kt"
click node_start "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/start/StartFragment.kt"
click node_game_screen "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/game/GameFragment.kt"
click node_board "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/game/SudokuBoardView.kt"
click node_viewmodel "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/shared/state/SudokuViewModel.kt"
click node_ui_state "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/shared/state/SudokuUiState.kt"
click node_results_screen "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/results/ResultsFragment.kt"
click node_effects "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/game/VictoryFireworksView.kt"
click node_game_engine "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/game/GameEngine.kt"
click node_rules "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/game/SudokuRules.kt"
click node_hints "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/hint/HintAnalyzer.kt"
click node_game_model "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/model/SudokuGame.kt"
click node_generate_use_case "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/generation/GeneratePuzzleUseCase.kt"
click node_generator "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/data/RandomSudokuGenerator.kt"
click node_difficulty "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/generation/SudokuDifficultyEvaluator.kt"
click node_game_repository "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/repository/GameRepository.kt"
click node_preferences "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/data/PreferencesGameRepository.kt"
click node_codec "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/data/SudokuJsonCodec.kt"
click node_results_repository "https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/repository/ResultsRepository.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_application,node_main,node_start,node_game_screen,node_board,node_viewmodel,node_ui_state,node_results_screen,node_effects toneBlue
class node_game_engine,node_rules,node_hints,node_game_model toneAmber
class node_generate_use_case,node_generator,node_difficulty toneMint
class node_game_repository,node_preferences,node_codec,node_results_repository toneRose
class node_player toneIndigo
```

## Components

### App presentation

- [Application](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/SudokuApplication.kt): `app/src/main/java/com/example/sudoku/SudokuApplication.kt`
- [Navigation](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/main/MainActivity.kt): `app/src/main/java/com/example/sudoku/presentation/main/MainActivity.kt`
- [Start screen](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/start/StartFragment.kt): `app/src/main/java/com/example/sudoku/presentation/start/StartFragment.kt`
- [Game screen](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/game/GameFragment.kt): `app/src/main/java/com/example/sudoku/presentation/game/GameFragment.kt`
- [Sudoku board](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/game/SudokuBoardView.kt): `app/src/main/java/com/example/sudoku/presentation/game/SudokuBoardView.kt`
- [Game state](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/shared/state/SudokuViewModel.kt): `app/src/main/java/com/example/sudoku/presentation/shared/state/SudokuViewModel.kt`
- [UI state](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/shared/state/SudokuUiState.kt): `app/src/main/java/com/example/sudoku/presentation/shared/state/SudokuUiState.kt`
- [Results screen](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/results/ResultsFragment.kt): `app/src/main/java/com/example/sudoku/presentation/results/ResultsFragment.kt`
- [Game effects](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/presentation/game/VictoryFireworksView.kt): `app/src/main/java/com/example/sudoku/presentation/game/VictoryFireworksView.kt`

### Gameplay domain

- [Game engine](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/game/GameEngine.kt): `app/src/main/java/com/example/sudoku/domain/game/GameEngine.kt`
- [Sudoku rules](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/game/SudokuRules.kt): `app/src/main/java/com/example/sudoku/domain/game/SudokuRules.kt`
- [Hint analysis](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/hint/HintAnalyzer.kt): `app/src/main/java/com/example/sudoku/domain/hint/HintAnalyzer.kt`
- [Game model](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/model/SudokuGame.kt): `app/src/main/java/com/example/sudoku/domain/model/SudokuGame.kt`

### Puzzle generation

- [Puzzle generation](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/generation/GeneratePuzzleUseCase.kt): `app/src/main/java/com/example/sudoku/domain/generation/GeneratePuzzleUseCase.kt`
- [Puzzle generator](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/data/RandomSudokuGenerator.kt): `app/src/main/java/com/example/sudoku/data/RandomSudokuGenerator.kt`
- [Difficulty evaluator](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/generation/SudokuDifficultyEvaluator.kt): `app/src/main/java/com/example/sudoku/domain/generation/SudokuDifficultyEvaluator.kt`

### Local data

- [Game repository](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/repository/GameRepository.kt): `app/src/main/java/com/example/sudoku/domain/repository/GameRepository.kt`
- [Saved game store](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/data/PreferencesGameRepository.kt): `app/src/main/java/com/example/sudoku/data/PreferencesGameRepository.kt`
- [Game JSON codec](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/data/SudokuJsonCodec.kt): `app/src/main/java/com/example/sudoku/data/SudokuJsonCodec.kt`
- [Results repository](https://github.com/akkovaleva14/sudoku/blob/main/app/src/main/java/com/example/sudoku/domain/repository/ResultsRepository.kt): `app/src/main/java/com/example/sudoku/domain/repository/ResultsRepository.kt`

### Other components

- **Player**

## Connections

- Player → Start screen: starts game (evidence: `README.md`)
- Player → Game screen: plays puzzle (evidence: `README.md`)
- Player → Results screen: views history (evidence: `README.md`)
- Application → Navigation: launches
- Navigation → Start screen: navigates
- Navigation → Game screen: navigates
- Navigation → Results screen: navigates
- Game screen → Sudoku board: displays
- Game screen → Game state: uses
- Game state → UI state: updates
- Game state → Game engine: delegates
- Game engine → Sudoku rules: checks rules
- Game engine → Hint analysis: requests hints
- Game engine → Game model: updates
- Start screen → Puzzle generation: requests puzzle
- Puzzle generation → Puzzle generator: generates
- Puzzle generation → Difficulty evaluator: evaluates difficulty
- Game state → Game repository: saves game
- Game repository → Saved game store: stores locally
- Saved game store → Game JSON codec: encodes data
- Results screen → Results repository: loads history
- Game screen → Game effects: shows outcome
