# ofirpicazo/solitario architecture

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

- Interactive diagram: https://gitdiagram.com/ofirpicazo/solitario
- Repository: https://github.com/ofirpicazo/solitario

## Overview

##### Main Components Organization

a) Presentation Layer
- This at the top level
- Static assets (HTML, fonts, images)
- SASS/CSS compilation pipeline

b) Game Core Layer
- This in the middle
- Main game logic components
- Event system (pubsub)

c) Storage Layer
- This at the bottom
- Game state persistence mechanism

##### Component Relationships

a) Game Components (Core Layer):
- It to subsidiary components:
- Stock (deck)
- Waste
- Foundation
- Tableau
- CardGroup
- Card

b) Storage System:
- Relationships with serializable game elements:
- GameForStorage
- CardForStorage
- PileForStorage

c) Asset Pipeline:
- SASS compilation flow
- Static asset serving

##### Specific Implementation Details

- Blue rectangles for core game components
- Green rectangles for storage-related components
- Yellow rectangles for UI/presentation components
- Purple diamonds for utility modules
- Gray rectangles for static assets

- Event flow through the pubsub system
- Game state updates
- Storage operations
- Asset serving paths

##### Component Grouping

- Game Logic Group (game/*.js files)
- Storage Group (storage/*.js files)
- Asset Group (static/*)
- Style Group (sass/*)

##### The component hierarchy in the game logic

Key Technical Elements to Include:
- Compass for SASS compilation
- HTML5 technologies used
- Browser storage mechanisms
- Event system architecture

- Grouping boundaries

Level of Detail:
- Major components (Game, Card, Pile, etc.)
- Event system architecture
- Storage interaction patterns
- Exclude internal implementation details of individual components

Remember to add notes about:
- Build process (Rake tasks)
- Development dependencies (Java JRE, Compass)
- Asset compilation flow

This will give other developers a complete picture of both the runtime architecture and the development/build process.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Presentation Layer"
        HTML["HTML Entry Point"]:::html
        SASS["SASS Styles"]:::sass
        BoardStyles["Board Styles"]:::sass
        CardStyles["Card Styles"]:::sass
        StaticAssets["Static Assets"]:::static
        SASS --> BoardStyles
        SASS --> CardStyles
    end

    subgraph "Game Core Layer"
        Game["Game Logic"]:::core
        PubSub["Event System"]:::core
        Card["Card Component"]:::core
        Stock["Stock Component"]:::core
        Waste["Waste Component"]:::core
        Foundation["Foundation Component"]:::core
        Tableau["Tableau Component"]:::core
        CardGroup["Card Group"]:::core
        Constants["Game Constants"]:::core
        Utils["Utility Functions"]:::core

        Game --> Stock
        Game --> Waste
        Game --> Foundation
        Game --> Tableau
        Stock --> CardGroup
        Waste --> CardGroup
        Foundation --> CardGroup
        Tableau --> CardGroup
        CardGroup --> Card
        Game --> PubSub
        Game --> Constants
        Game --> Utils
    end

    subgraph "Storage Layer"
        CardStorage["Card Storage"]:::storage
        GameStorage["Game State Storage"]:::storage
        PileStorage["Pile Storage"]:::storage
        
        GameStorage --> CardStorage
        GameStorage --> PileStorage
    end

    subgraph "Application Entry"
        App["Main Application"]:::entry
    end

    App --> Game
    Game --> GameStorage
    HTML --> App

    classDef core fill:#a8d1f0
    classDef storage fill:#98fb98
    classDef html fill:#f4d03f
    classDef sass fill:#f4d03f
    classDef static fill:#f4d03f
    classDef entry fill:#dda0dd

    click HTML "https://github.com/ofirpicazo/solitario/blob/master/static/index.html"
    click SASS "https://github.com/ofirpicazo/solitario/blob/master/src/sass/app.scss"
    click BoardStyles "https://github.com/ofirpicazo/solitario/blob/master/src/sass/_board.scss"
    click CardStyles "https://github.com/ofirpicazo/solitario/blob/master/src/sass/_cards.scss"
    click StaticAssets "https://github.com/ofirpicazo/solitario/tree/master/static/fonts"
    click Game "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/game.js"
    click PubSub "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/pubsub.js"
    click Card "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/card.js"
    click Stock "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/stock.js"
    click Waste "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/waste.js"
    click Foundation "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/foundation.js"
    click Tableau "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/tableu.js"
    click CardGroup "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/cardgroup.js"
    click Constants "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/constants.js"
    click Utils "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/utils.js"
    click CardStorage "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/storage/cardforstorage.js"
    click GameStorage "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/storage/gameforstorage.js"
    click PileStorage "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/game/storage/pileforstorage.js"
    click App "https://github.com/ofirpicazo/solitario/blob/master/src/solitario/app.js"
```
