# zinb-il/42-n-puzzle architecture

> Architecture diagram of the GitHub repository zinb-il/42-n-puzzle, 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/zinb-il/42-n-puzzle
- Repository: https://github.com/zinb-il/42-n-puzzle

## Overview

This small Python program accepts a puzzle-file path on the command line, parses and validates the file, and constructs an NPuzzle object. The parser reads the file itself and populates the puzzle’s size, grid, and blank-position fields. Although parse_file is annotated to return a puzzle, it does not actually return one, so the command-line flow exposes no parsed result. The sampled code shows no solving or search behavior; map files are inputs, not runtime components.

Main entry points: [`parsing.py`](https://github.com/zinb-il/42-n-puzzle/blob/main/parsing.py) (File parser), [`main.py`](https://github.com/zinb-il/42-n-puzzle/blob/main/main.py) (Command line), [`src/n_puzzle.py`](https://github.com/zinb-il/42-n-puzzle/blob/main/src/n_puzzle.py) (Puzzle model)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_cli["Command line<br/>[main.py]"]
node_input["Puzzle file"]
node_parser["File parser<br/>[parsing.py]"]
node_puzzle["Puzzle model<br/>[n_puzzle.py]"]

node_user -->|"runs with path"| node_cli
node_cli -->|"calls"| node_parser
node_input -->|"reads"| node_parser
node_parser -->|"constructs"| node_puzzle

click node_cli "https://github.com/zinb-il/42-n-puzzle/blob/main/main.py"
click node_parser "https://github.com/zinb-il/42-n-puzzle/blob/main/parsing.py"
click node_puzzle "https://github.com/zinb-il/42-n-puzzle/blob/main/src/n_puzzle.py"

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_user toneBlue
class node_cli,node_parser toneTeal
class node_input,node_puzzle toneIndigo
```

## Components

### Other components

- **User**
- [Command line](https://github.com/zinb-il/42-n-puzzle/blob/main/main.py): `main.py`
- **Puzzle file**
- [File parser](https://github.com/zinb-il/42-n-puzzle/blob/main/parsing.py): `parsing.py`
- [Puzzle model](https://github.com/zinb-il/42-n-puzzle/blob/main/src/n_puzzle.py): `src/n_puzzle.py`

## Connections

- User → Command line: runs with path (evidence: `main.py`)
- Command line → File parser: calls (evidence: `main.py`)
- Puzzle file → File parser: reads (evidence: `parsing.py`)
- File parser → Puzzle model: constructs (evidence: `parsing.py`)
