# javalc6/sudoku architecture

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

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

## Overview

This repository provides two ways to use Sudoku: an interactive Swing game and a command-line solver/generator. The main workflow is to create or enter a board, solve it with a selected algorithm, and show the result. The solver includes recursive, bitmap, optimized bitmap, and Dancing Links approaches; it also supports board validation, uniqueness checks, and benchmark boards. The game’s UI and solver calls are visible in the excerpts. Some benchmark wiring is only documented or indexed, so those relationships are shown only where supported.

Main entry points: [`src/solver/Sudoku.java`](https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java) (Board and checks), [`src/game/SudokuGame.java`](https://github.com/javalc6/sudoku/blob/main/src/game/SudokuGame.java) (Swing game), [`src/dlx/SudokuDLX.java`](https://github.com/javalc6/sudoku/blob/main/src/dlx/SudokuDLX.java) (Exact-cover solver), [`src/solver/Resources.java`](https://github.com/javalc6/sudoku/blob/main/src/solver/Resources.java) (Benchmark boards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Interactive game"]
  node_sudoku_game["Swing game<br/>[SudokuGame.java]"]
  node_move_checks["Move validation<br/>[SudokuGame.java]"]
end

subgraph group_solver["Board and solvers"]
  node_board_generation["Puzzle generation<br/>[Sudoku.java]"]
  node_board_state["Board and checks<br/>[Sudoku.java]"]
  node_recursive_solver["Recursive solver<br/>[Sudoku.java]"]
  node_bitmap_solvers["Bitmap solvers<br/>[Sudoku.java]"]
  node_uniqueness["Uniqueness check<br/>[Sudoku.java]"]
  node_board_input["Board parsing<br/>[Sudoku.java]"]
  node_dlx_adapter["DLX adapter<br/>[Sudoku.java]"]
end

subgraph group_dlx["Dancing Links"]
  node_dlx_solver["Exact-cover solver<br/>[SudokuDLX.java]"]
end

subgraph group_benchmark["Benchmark data"]
  node_benchmark_data["Benchmark boards<br/>[Resources.java]"]
end

node_player(("Player"))
node_cli_user(("CLI user"))

node_player -->|"plays"| node_sudoku_game
node_cli_user -->|"supplies board"| node_board_input
node_sudoku_game -->|"generates puzzle"| node_board_generation
node_sudoku_game -->|"checks moves"| node_move_checks
node_sudoku_game -->|"requests solve"| node_bitmap_solvers
node_board_generation -->|"checks uniqueness"| node_uniqueness
node_board_generation -->|"solves board"| node_recursive_solver
node_recursive_solver -->|"checks candidates"| node_board_state
node_bitmap_solvers -->|"reads board"| node_board_state
node_dlx_adapter -->|"delegates solve"| node_dlx_solver
node_dlx_adapter -->|"imports result"| node_board_state
node_cli_user -->|"runs commands"| node_board_state
node_board_state -.->|"uses benchmark boards"| node_benchmark_data

click node_sudoku_game "https://github.com/javalc6/sudoku/blob/main/src/game/SudokuGame.java"
click node_move_checks "https://github.com/javalc6/sudoku/blob/main/src/game/SudokuGame.java"
click node_board_generation "https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java"
click node_board_state "https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java"
click node_recursive_solver "https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java"
click node_bitmap_solvers "https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java"
click node_uniqueness "https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java"
click node_board_input "https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java"
click node_dlx_adapter "https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java"
click node_dlx_solver "https://github.com/javalc6/sudoku/blob/main/src/dlx/SudokuDLX.java"
click node_benchmark_data "https://github.com/javalc6/sudoku/blob/main/src/solver/Resources.java"

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_sudoku_game,node_move_checks,node_cli_user toneBlue
class node_board_generation,node_board_state,node_recursive_solver,node_bitmap_solvers,node_uniqueness,node_board_input,node_dlx_adapter toneAmber
class node_dlx_solver toneMint
class node_benchmark_data toneRose
class node_player toneIndigo
```

## Components

### Interactive game

- [Swing game](https://github.com/javalc6/sudoku/blob/main/src/game/SudokuGame.java): `src/game/SudokuGame.java`
- [Move validation](https://github.com/javalc6/sudoku/blob/main/src/game/SudokuGame.java): `src/game/SudokuGame.java`

### Board and solvers

- [Puzzle generation](https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java): `src/solver/Sudoku.java`
- [Board and checks](https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java): `src/solver/Sudoku.java`
- [Recursive solver](https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java): `src/solver/Sudoku.java`
- [Bitmap solvers](https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java): `src/solver/Sudoku.java`
- [Uniqueness check](https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java): `src/solver/Sudoku.java`
- [Board parsing](https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java): `src/solver/Sudoku.java`
- [DLX adapter](https://github.com/javalc6/sudoku/blob/main/src/solver/Sudoku.java): `src/solver/Sudoku.java`

### Dancing Links

- [Exact-cover solver](https://github.com/javalc6/sudoku/blob/main/src/dlx/SudokuDLX.java): `src/dlx/SudokuDLX.java`

### Benchmark data

- [Benchmark boards](https://github.com/javalc6/sudoku/blob/main/src/solver/Resources.java): `src/solver/Resources.java`

### Other components

- **Player**
- **CLI user**

## Connections

- Player → Swing game: plays (evidence: `README.md`)
- CLI user → Board parsing: supplies board (evidence: `README.md`)
- Swing game → Puzzle generation: generates puzzle (evidence: `src/game/SudokuGame.java`)
- Swing game → Move validation: checks moves (evidence: `src/game/SudokuGame.java`)
- Swing game → Bitmap solvers: requests solve (evidence: `src/game/SudokuGame.java`)
- Puzzle generation → Uniqueness check: checks uniqueness (evidence: `src/solver/Sudoku.java`)
- Puzzle generation → Recursive solver: solves board (evidence: `src/solver/Sudoku.java`)
- Recursive solver → Board and checks: checks candidates (evidence: `src/solver/Sudoku.java`)
- Bitmap solvers → Board and checks: reads board (evidence: `src/solver/Sudoku.java`)
- DLX adapter → Exact-cover solver: delegates solve (evidence: `src/solver/Sudoku.java`)
- DLX adapter → Board and checks: imports result (evidence: `src/solver/Sudoku.java`)
- CLI user → Board and checks: runs commands (evidence: `README.md`)
- Board and checks → Benchmark boards: uses benchmark boards (evidence: `src/solver/Sudoku.java`)
