# sai-pratham05/word-master architecture

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

- Interactive diagram: https://gitdiagram.com/sai-pratham05/word-master
- Repository: https://github.com/sai-pratham05/word-master

## Overview

##### Project Type and Purpose
- This is a single‐page frontend application (HTML/CSS/JS).
- Purpose: Let users guess a five‐letter word in up to six tries, providing feedback on letter correctness and placement.

##### File Structure
- Top‐level: README.md (project overview)
- Directory “wordle (project 1)”:
– index.html → UI skeleton and container elements (input grid, feedback region)
– scripts.js → core game logic, state management, event handlers, word list or API fetch

##### README Insights
- Confirms frontend‐only, no backend services.
- Rules: six attempts, five‐letter target per round.
- Implied needs: word‐dictionary (in‐memory or external file), input validation, UI feedback loops.

##### Main Components & Their Relationships
a. Components
1. Browser UI (index.html + CSS)
2. Game Engine (scripts.js)
- State Store (current guess, attempt count, target word)
- Validation Module (checks guess vs target)
- Feedback Generator (computes per‐letter status)
3. Word Dictionary (could be an array in scripts.js or fetched JSON)
4. Optional Persistence/Enhancements (e.g., localStorage for stats)
b. Interactions
– At end of game → Engine may read/write stats to localStorage → UI shows result modal
c. Architectural Patterns
– Separation of Concerns:
- Presentation (HTML/CSS) vs. Logic (JavaScript) vs. Data (word list)
– Event‐Driven Flow: user input triggers game‐state transitions
d. Key Technologies
– HTML5 (UI structure)
– Vanilla JavaScript (ES6 modules or IIFE patterns)
– (Optional) localStorage API for persistence

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["Browser UI\n(index.html)"]:::presentation
        CSS["CSS Styling\n(styles.css)"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        State["State Store & Validation Module"]:::logic
        Feedback["Feedback Generator"]:::logic
    end

    %% Data Layer
    subgraph "Data Layer"
        Dict[(Word Dictionary)]:::data
        Persistence[(localStorage API)]:::data
    end

    %% External Documentation
    README["Project Overview\n(README.md)"]:::external

    %% Connections
    UI -->|"inputEvent"| State
    CSS --> State
    State -->|"loadWordList"| Dict
    Dict -->|"wordList"| State
    State -->|"validateGuess"| Feedback
    Feedback -->|"updateUI"| UI
    State <-->|"saveStats"| Persistence
    State <-->|"loadStats"| Persistence
    README -.-> UI

    %% Click Events
    click UI "https://github.com/sai-pratham05/word-master/blob/main/wordle (project 1)/index.html"
    click CSS "https://github.com/sai-pratham05/word-master/blob/main/wordle (project 1)/styles.css"
    click State "https://github.com/sai-pratham05/word-master/blob/main/wordle (project 1)/scripts.js"
    click Feedback "https://github.com/sai-pratham05/word-master/blob/main/wordle (project 1)/scripts.js"
    click Dict "https://github.com/sai-pratham05/word-master/blob/main/wordle (project 1)/scripts.js"
    click Persistence "https://github.com/sai-pratham05/word-master/blob/main/wordle (project 1)/scripts.js"
    click README "https://github.com/sai-pratham05/word-master/blob/main/README.md"

    %% Styles
    classDef presentation fill:#D0E6FF,stroke:#0366D6,color:#0366D6
    classDef logic fill:#E6FFEA,stroke:#238636,color:#22863A
    classDef data fill:#FFF5B1,stroke:#D69D00,color:#735C0F
    classDef external fill:#F0F0F0,stroke:#999999,color:#333333
```
