# aadip-thapaliya/project-1 architecture

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

- Interactive diagram: https://gitdiagram.com/aadip-thapaliya/project-1
- Repository: https://github.com/aadip-thapaliya/project-1

## Overview

##### Project type and purpose
- This is a small, single‐module command-line (terminal) Python application implementing Tic Tac Toe for two local players.
- It has no client/server split, no database or external services—just an interactive prompt, game logic, and board state management.

##### File structure
- Top-level files:
- Project 1.ipynb – Jupyter notebook containing the entire game code (cells for imports, functions, game‐loop).
- README.md – documentation of rules, features, and usage.
- No separate “src/” or “lib/” folders; everything lives in one notebook.
- No build scripts, no configuration, no external dependencies.

##### Key components
a. User Interface (CLI Layer)
- Reads player input (marker choice, position choice, replay choice)
b. Game Controller
- Orchestrates turn order (including random first player selection)
c. Board State Model
- A list of 10 strings, index 1–9 map to board positions
- Maintains current markers
d. Game Logic / Utility Functions
- place_marker(board, marker, position)
- win_check(board, marker)
- full_board_check(board)
- replay() prompt
e. Randomizer Module
- random.choice to decide which player goes first

##### Relationships and data flows
- Player → CLI Layer: input
- CLI Layer → Controller: user decisions (marker, position)
- Controller → Board Model: update board
- Logic Functions → Controller: Boolean results
- Controller → CLI Layer: messages/outcome
- Controller → Randomizer: initial turn assignment

##### Architectural patterns / design principles
- Layered design: separate concerns (I/O vs. game logic vs. data model)
- Single execution loop in the Controller
- Stateless utility functions operate on the Board Model
- Use of Python standard library only

##### Checklist for the principal software engineer
- Five components and dependencies between them.
- Game loop cycle: input → process → update → output.
- Where Python’s standard library (random module, input/output) is used.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Documentation Layer"
        Documentation["README.md"]:::doc
    end

    subgraph "CLI Layer"
        CLI["CLI Interface"]:::io
    end

    subgraph "Core Logic Layer"
        Controller["Game Controller"]:::core
        Logic["Game Logic"]:::core
    end

    subgraph "Data Model Layer"
        Board["Board Model"]:::data
    end

    subgraph "Utility Layer"
        Randomizer["Randomizer"]:::rand
    end

    Documentation -->|describes usage| CLI
    CLI -->|user input| Controller
    Controller -->|update board| Board
    Controller -->|invoke logic| Logic
    Logic -->|result bools| Controller
    Controller -->|initial turn request| Randomizer
    Randomizer -->|first player| Controller
    Controller -->|output messages| CLI

    click CLI "https://github.com/aadip-thapaliya/project-1/blob/main/Project 1.ipynb"
    click Controller "https://github.com/aadip-thapaliya/project-1/blob/main/Project 1.ipynb"
    click Board "https://github.com/aadip-thapaliya/project-1/blob/main/Project 1.ipynb"
    click Logic "https://github.com/aadip-thapaliya/project-1/blob/main/Project 1.ipynb"
    click Randomizer "https://github.com/aadip-thapaliya/project-1/blob/main/Project 1.ipynb"
    click Documentation "https://github.com/aadip-thapaliya/project-1/blob/main/README.md"

    classDef io fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef core fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFFFE0,stroke:#333,stroke-width:1px
    classDef rand fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef doc fill:#F5DEB3,stroke:#333,stroke-width:1px
```
