# harshagarwal2245/guess_game architecture

> Architecture diagram of the GitHub repository harshagarwal2245/guess_game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshagarwal2245/guess_game
- Repository: https://github.com/harshagarwal2245/guess_game

## Overview

##### Project type and purpose
- This is a small, single‐binarry, command-line Rust application (“Guess the Number”).
- It has no client/server split, database, or network layer—it’s a console tool that generates a random number, reads user input, compares values, and prints feedback.

##### File structure
- Top level: Cargo.toml, README.md, and src/main.rs.
- No submodules or multiple crates—everything lives in main.rs.
- Cargo.toml lists dependencies (e.g., the “rand” crate).

##### README for additional insights
- Confirms key features: random number generation (1–100), console I/O, comparison logic, and error handling following Rust best practices.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Nodes
    User["User Console"]:::console
    Parser["Input Parser (std::io)"]:::console
    Error["Error Handler"]:::error
    subgraph "Game Loop / Controller"
        GameLoop["Game Loop / Controller"]:::logic
        Comparison["Comparison Logic"]:::logic
        Output["Output Formatter"]:::console
    end
    RNG["Third-party RNG (rand crate)"]:::external
    Cargo["Cargo.toml (rand dependency)"]:::external

    %% Connections
    User -->|"stdin"| Parser
    Parser -->|"parsed i32"| GameLoop
    Parser -.->|"parse error"| Error
    Error -->|"error message"| User
    GameLoop -->|"generate secret on start"| RNG
    Cargo --> RNG
    GameLoop -->|"invoke comparison"| Comparison
    Comparison -->|"Result (TooSmall/TooBig/Correct)"| Output
    Output -->|"stdout"| User

    %% Click Events
    click Parser "https://github.com/harshagarwal2245/guess_game/blob/master/src/main.rs"
    click GameLoop "https://github.com/harshagarwal2245/guess_game/blob/master/src/main.rs"
    click Comparison "https://github.com/harshagarwal2245/guess_game/blob/master/src/main.rs"
    click Output "https://github.com/harshagarwal2245/guess_game/blob/master/src/main.rs"
    click RNG "https://github.com/harshagarwal2245/guess_game/blob/master/src/main.rs"
    click Error "https://github.com/harshagarwal2245/guess_game/blob/master/src/main.rs"
    click Cargo "https://github.com/harshagarwal2245/guess_game/blob/master/Cargo.toml"

    %% Styles
    classDef console fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef error fill:#FFC0CB,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
