# calda/1010 architecture

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

- Interactive diagram: https://gitdiagram.com/calda/1010
- Repository: https://github.com/calda/1010

## Overview

##### Project type and purpose
- This is a mobile puzzle game (“1010”) written in SwiftUI for iOS.
- It’s essentially a single‐module, full-stack (front-end + logic) application that lives entirely on the device, with optional integration to Apple’s Game Center.

##### File structure
- Top-level:
- TenTen.xcodeproj – the Xcode project/workspace files
- TenTen/ – your app’s source folder
- TenTenTests/ – unit tests target
- Images/ & Resources/ – non-source assets (videos, privacy policy)
- Inside TenTen/:
- Game/ – SwiftUI views handling the active gameplay UI (BoardView, GameView, PiecesTray, TopControls)
- Screens/ – other SwiftUI screens and overlays (AboutScreen, ErrorScreen, GameOverScreen, SettingsOverlay)
- Model/ – core game data and logic (Game, Piece, BoardLayout, EnvironmentValues) plus GameCenterManager
- TenTenApp.swift – app entry point and scene/SwiftUI lifecycle

##### README for additional insights
- The README confirms a pure SwiftUI front end with descriptive screenshots. No separate backend or microservices—game logic and UI are packaged together.

## Diagram (Mermaid)

```mermaid
flowchart TB
    Device["iOS Device / App Container"]:::external
    Device --> TenTenApp

    TenTenApp["TenTenApp"]:::appEntry
    click TenTenApp "https://github.com/calda/1010/blob/main/TenTen/TenTenApp.swift"

    subgraph "View Layer"
        BoardView["BoardView"]:::ui
        click BoardView "https://github.com/calda/1010/blob/main/TenTen/Game/BoardView.swift"
        GameView["GameView"]:::ui
        click GameView "https://github.com/calda/1010/blob/main/TenTen/Game/GameView.swift"
        PiecesTray["PiecesTray"]:::ui
        click PiecesTray "https://github.com/calda/1010/blob/main/TenTen/Game/PiecesTray.swift"
        TopControls["TopControls"]:::ui
        click TopControls "https://github.com/calda/1010/blob/main/TenTen/Game/TopControls.swift"
        AboutScreen["AboutScreen"]:::ui
        click AboutScreen "https://github.com/calda/1010/blob/main/TenTen/Screens/AboutScreen.swift"
        ErrorScreen["ErrorScreen"]:::ui
        click ErrorScreen "https://github.com/calda/1010/blob/main/TenTen/Screens/ErrorScreen.swift"
        GameOverScreen["GameOverScreen"]:::ui
        click GameOverScreen "https://github.com/calda/1010/blob/main/TenTen/Screens/GameOverScreen.swift"
        SettingsOverlay["SettingsOverlay"]:::ui
        click SettingsOverlay "https://github.com/calda/1010/blob/main/TenTen/Screens/SettingsOverlay.swift"
    end

    TenTenApp --> BoardView
    BoardView -->|"@StateObject / @Binding"| Game
    GameView -->|"@Binding / @StateObject"| Game
    PiecesTray -->|"@Binding"| Game
    TopControls -->|"@Binding"| Game
    AboutScreen -->|"@EnvironmentObject"| Game
    ErrorScreen -->|"@EnvironmentObject"| Game
    GameOverScreen -->|"@EnvironmentObject"| Game
    SettingsOverlay -->|"@EnvironmentObject"| Game

    subgraph "Model Layer"
        Game["Game"]:::model
        click Game "https://github.com/calda/1010/blob/main/TenTen/Model/Game.swift"
        BoardLayout["BoardLayout"]:::model
        click BoardLayout "https://github.com/calda/1010/blob/main/TenTen/Model/BoardLayout.swift"
        Piece["Piece"]:::model
        click Piece "https://github.com/calda/1010/blob/main/TenTen/Model/Piece.swift"
        EnvironmentValues["EnvironmentValues"]:::model
        click EnvironmentValues "https://github.com/calda/1010/blob/main/TenTen/Model/EnvironmentValues.swift"
        GameCenterManager["GameCenterManager"]:::service
        click GameCenterManager "https://github.com/calda/1010/blob/main/TenTen/Model/GameCenterManager.swift"
    end

    Game --> BoardLayout
    Game --> Piece
    Game --> EnvironmentValues
    GameCenterManager -->|"auth & leaderboard"| AppleGC

    subgraph "Assets & Resources"
        Assets["Asset Catalogs"]:::resource
        click Assets "https://github.com/calda/1010/blob/main/TenTen/Resources/Assets.xcassets"
        InfoPlist["Info.plist"]:::resource
        click InfoPlist "https://github.com/calda/1010/blob/main/TenTen/Resources/Info.plist"
        Entitlements["Entitlements"]:::resource
        click Entitlements "https://github.com/calda/1010/blob/main/TenTen/Resources/TenTen.entitlements"
    end

    TenTenApp --> Assets
    TenTenApp --> InfoPlist
    TenTenApp --> Entitlements

    subgraph "Test Targets"
        TenTenTests["TenTenTests"]:::test
        click TenTenTests "https://github.com/calda/1010/blob/main/TenTenTests/TenTenTests.swift"
        DeserializationTests["DeserializationTests"]:::test
        click DeserializationTests "https://github.com/calda/1010/blob/main/TenTenTests/DeserializationTests.swift"
    end

    TenTenTests --> Game
    TenTenTests --> BoardLayout
    TenTenTests --> Piece
    DeserializationTests --> Game
    DeserializationTests --> BoardLayout
    DeserializationTests --> Piece

    XcodeProj["TenTen.xcodeproj"]:::resource
    click XcodeProj "https://github.com/calda/1010/blob/main/TenTen.xcodeproj"

    Device --> XcodeProj

    GameCenterManager -.-> AppleGC
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef model fill:#90EE90,stroke:#333,stroke-width:1px
    classDef service fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:none,stroke:#f66,stroke-dasharray: 5 5,stroke-width:2px
    classDef resource fill:#FFD700,stroke:#333,stroke-width:1px
    classDef test fill:#D3D3D3,stroke:#333,stroke-width:1px
```
