# keypang/swe-yutgame architecture

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

- Interactive diagram: https://gitdiagram.com/keypang/swe-yutgame
- Repository: https://github.com/keypang/swe-yutgame

## Overview

##### Project type and purpose
- This is a standalone Java desktop application that implements the traditional Yut board game.
- It follows the Model-View-Controller (MVC) pattern and uses Swing for its UI, Maven (pom.xml) for build/dependencies, and JUnit for tests.

##### File structure
- Top-level files:
- pom.xml → Maven build, dependency management, entry point.
- README.md, LICENSE, .gitignore → project metadata.
- src/Main.java → application entry point.
- src/controller → controllers for screens: StartScreenController, GameScreenController.
- src/view → Swing-based views and configuration/play screens, plus an images folder.
- src/model → core domain classes (Board, Cell, Piece, Player, Yut, etc.) and GameManager (game logic).
- test/ → unit tests organized by package mirroring src.

##### README for additional insights
- README only gives the project name. We infer from code organization: Swing-MVC desktop Yut game, no external services.

##### Key points to capture
- Clear separation of MVC layers.
- The flow of control and data throughout the game lifecycle (configuration → play → result).
- The use of PositionDTO and YutResult as data transfer between Model and Controller.
- The absence of external systems or persistent storage—focus on in-memory game logic.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External User
    User["User"]:::external

    %% Entry Point
    Main["Main.java"]:::build

    %% View Layer
    subgraph "View Layer"
        ConfigView["SwingConfigScreen"]:::view
        PlayView["SwingPlayScreen"]:::view
        GameConfigView["GameConfigView"]:::view
        GamePlayView["GamePlayView"]:::view
    end

    %% Controller Layer
    subgraph "Controller Layer"
        StartController["StartScreenController"]:::controller
        GameController["GameScreenController"]:::controller
    end

    %% Model Layer
    subgraph "Model Layer"
        GameManager["GameManager"]:::model
        subgraph "Domain Model"
            Board["Board"]:::model
            Cell["Cell"]:::model
            Piece["Piece"]:::model
            Player["Player"]:::model
            BoardType["BoardType"]:::model
        end
        Yut["Yut"]:::model
        YutResult["YutResult"]:::model
        PositionDTO["PositionDTO"]:::model
        StartInfo["StartInfo"]:::model
    end

    %% Build & Test
    subgraph "Build & Test"
        Maven["pom.xml"]:::build
        ControllerTest["YutThrowTest.java"]:::build
        ModelTest1["GameManagerTest.java"]:::build
        ModelTest2["YutThrowTest1.java"]:::build
    end

    %% Workflow
    User -->|"clicks Start"| ConfigView
    Main --> ConfigView
    Main --> StartController

    ConfigView -->|"onStartButtonClicked()"| StartController
    StartController -->|"gameManager.startGame()"| GameManager
    GameManager -->|"initializes Board etc."| Board
    GameManager -->|"initializes Players etc."| Player
    GameManager -->|"returns StartInfo"| StartInfo
    StartController -->|"showConfig()"| GameConfigView

    GameConfigView -->|"onPlayButtonClicked()"| GameController
    GameController -->|"gameManager.throwYut()"| GameManager
    GameManager -->|"returns YutResult"| YutResult
    GameManager -->|"returns PositionDTO"| PositionDTO
    GameController -->|"updateBoardView()"| GamePlayView

    %% Build & Test relations
    Maven --> Main
    Maven --> ControllerTest
    Maven --> ModelTest1
    Maven --> ModelTest2

    %% Click Events
    click Main "https://github.com/keypang/swe-yutgame/blob/main/src/Main.java"
    click ConfigView "https://github.com/keypang/swe-yutgame/blob/main/src/view/SwingConfigScreen.java"
    click PlayView "https://github.com/keypang/swe-yutgame/blob/main/src/view/SwingPlayScreen.java"
    click GameConfigView "https://github.com/keypang/swe-yutgame/blob/main/src/view/GameConfigView.java"
    click GamePlayView "https://github.com/keypang/swe-yutgame/blob/main/src/view/GamePlayView.java"
    click StartController "https://github.com/keypang/swe-yutgame/blob/main/src/controller/StartScreenController.java"
    click GameController "https://github.com/keypang/swe-yutgame/blob/main/src/controller/GameScreenController.java"
    click GameManager "https://github.com/keypang/swe-yutgame/blob/main/src/model/GameManager.java"
    click Board "https://github.com/keypang/swe-yutgame/blob/main/src/model/Board.java"
    click BoardType "https://github.com/keypang/swe-yutgame/blob/main/src/model/BoardType.java"
    click Cell "https://github.com/keypang/swe-yutgame/blob/main/src/model/Cell.java"
    click Piece "https://github.com/keypang/swe-yutgame/blob/main/src/model/Piece.java"
    click Player "https://github.com/keypang/swe-yutgame/blob/main/src/model/Player.java"
    click Yut "https://github.com/keypang/swe-yutgame/blob/main/src/model/Yut.java"
    click YutResult "https://github.com/keypang/swe-yutgame/blob/main/src/model/YutResult.java"
    click PositionDTO "https://github.com/keypang/swe-yutgame/blob/main/src/model/PositionDTO.java"
    click StartInfo "https://github.com/keypang/swe-yutgame/blob/main/src/model/StartInfo.java"
    click Maven "https://github.com/keypang/swe-yutgame/blob/main/pom.xml"
    click ControllerTest "https://github.com/keypang/swe-yutgame/blob/main/test/controller/YutThrowTest.java"
    click ModelTest1 "https://github.com/keypang/swe-yutgame/blob/main/test/model/GameManagerTest.java"
    click ModelTest2 "https://github.com/keypang/swe-yutgame/blob/main/test/model/YutThrowTest1.java"

    %% Styles
    classDef view fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef controller fill:#d4edda,stroke:#333,stroke-width:1px
    classDef model fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef build fill:#e2e3e5,stroke:#333,stroke-width:1px
    classDef external fill:#f8d7da,stroke:#333,stroke-width:1px
```
