# tom-ludwig/allinorfold architecture

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

- Interactive diagram: https://gitdiagram.com/tom-ludwig/allinorfold
- Repository: https://github.com/tom-ludwig/allinorfold

## Overview

##### Project Type and Purpose
- This is a single‐module Kotlin command-line application (educational student project) that implements the core mechanics of a poker game (“AllInOrFold”).
- It uses Maven as build tool, GitHub Actions for CI (lint/format checks and unit tests), and Just as a convenience wrapper for common Maven commands.

##### High-Level Architecture
The system can be represented in four main components:
- CLI & Entrypoint Layer
- Application Core (Game Orchestrator)
- Domain Model (Poker Entities)
- Infrastructure & Tooling (Build, CI/CD, Tests)

##### Components and Relationships
A. CLI & Entrypoint Layer
- Contains the main() function that initializes and runs the poker game.
- Parses user input (e.g., number of players, actions: fold/call/all-in).
- Invokes the Game Orchestrator.

B. Application Core (Game.kt)
- Coordinates gameplay: shuffles the Deck, deals to Players, advances Rounds, evaluates hands.
- Holds references to Deck, Players, and Round objects.
- Exposes public methods like startGame(), nextRound() which the CLI calls.

C. Domain Model (in package hwr.oop.group1.poker)
- Card, CardSuit, CardRank: immutable value objects.
- Player: holds hand (list of Card) and state (chips, status).
- Round: manages bets, community cards, tracks current pot.
- HandType & HandRank: logic to evaluate and compare poker hands.

D. Infrastructure & Tooling
- pom.xml / .mvn: Maven project configuration.
- justfile: shortcut commands for build/test.
- .github/workflows: GitHub Actions for lint/format and unit-test CI pipelines.
- src/test: JUnit tests for each domain and core component.

##### Architectural Patterns and Principles
- Layered Architecture:
– Presentation (CLI)
– Application (Game orchestrator)
– Domain (Entities & business logic)
– Infrastructure (build & CI)
- Package-By-Feature: all poker logic lives under a single feature package.
- Dependency Direction: Outer layers depend on inner layers (CLI depends on Core; Core depends on Domain).

- Notes on external tools (Maven, Just, GitHub Actions).

## Diagram (Mermaid)

```mermaid
graph TB
    %% Layers
    subgraph "CLI & Entrypoint Layer"
        CLI_shell["cli/"]:::presentation
        Just["justfile"]:::presentation
        Main["Game.kt (main)"]:::presentation
    end

    subgraph "Application Core"
        Core["Game.kt (startGame(), nextRound())"]:::application
    end

    subgraph "Domain Model"
        Card["Card.kt"]:::domain
        CardSuit["CardSuit.kt"]:::domain
        CardRank["CardRank.kt"]:::domain
        Deck["Deck.kt"]:::domain
        Player["Player.kt"]:::domain
        Round["Round.kt"]:::domain
        HandType["HandType.kt"]:::domain
        HandRank["HandRank.kt"]:::domain
    end

    subgraph "Infrastructure & Tooling"
        POM["pom.xml"]:::infra
        Wrapper[".mvn/wrapper"]:::infra
        LintCI[".github/workflows/check_lint_and_format.yaml"]:::infra
        TestCI[".github/workflows/test-runner.yaml"]:::infra
        CardTest["CardTest.kt"]:::infra
        DeckTest["DeckTest.kt"]:::infra
        GameTest["GameTest.kt"]:::infra
        HandRankTest["HandRankTest.kt"]:::infra
        PlayerTest["PlayerTest.kt"]:::infra
        RoundTest["RoundTest.kt"]:::infra
    end

    User["User"]:::external

    %% Connections
    User -->|"inputs: num players & actions"| Main
    CLI_shell -->|"entry helper"| Main
    Main -->|"invokes"| Core
    Core -->|"uses"| Deck
    Core -->|"uses"| Player
    Core -->|"uses"| Round
    Round -->|"evaluates"| HandRank
    Deck -->|"contains"| Card
    Player -->|"holds"| Card
    HandRank -->|"logic from"| HandType

    LintCI -->|"runs on CI"| POM
    TestCI -->|"runs on CI"| POM
    Just -->|"invokes mvn"| POM
    POM -->|"build & test"| Core
    POM -->|"build & test"| Domain

    CardTest -->|"tests"| Card
    DeckTest -->|"tests"| Deck
    GameTest -->|"tests"| Core
    HandRankTest -->|"tests"| HandRank
    PlayerTest -->|"tests"| Player
    RoundTest -->|"tests"| Round

    %% Click Events
    click CLI_shell "https://github.com/tom-ludwig/allinorfold/tree/main/cli/"
    click Just "https://github.com/tom-ludwig/allinorfold/tree/main/justfile"
    click Main "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/Game.kt"
    click Core "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/Game.kt"
    click Card "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/Card.kt"
    click CardSuit "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/CardSuit.kt"
    click CardRank "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/CardRank.kt"
    click Deck "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/Deck.kt"
    click Player "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/Player.kt"
    click Round "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/Round.kt"
    click HandType "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/HandType.kt"
    click HandRank "https://github.com/tom-ludwig/allinorfold/blob/main/src/main/kotlin/hwr/oop/group1/poker/HandRank.kt"
    click POM "https://github.com/tom-ludwig/allinorfold/blob/main/pom.xml"
    click Wrapper "https://github.com/tom-ludwig/allinorfold/tree/main/.mvn/wrapper"
    click LintCI "https://github.com/tom-ludwig/allinorfold/blob/main/.github/workflows/check_lint_and_format.yaml"
    click TestCI "https://github.com/tom-ludwig/allinorfold/blob/main/.github/workflows/test-runner.yaml"
    click CardTest "https://github.com/tom-ludwig/allinorfold/blob/main/src/test/kotlin/hwr/oop/group1/poker/CardTest.kt"
    click DeckTest "https://github.com/tom-ludwig/allinorfold/blob/main/src/test/kotlin/hwr/oop/group1/poker/DeckTest.kt"
    click GameTest "https://github.com/tom-ludwig/allinorfold/blob/main/src/test/kotlin/hwr/oop/group1/poker/GameTest.kt"
    click HandRankTest "https://github.com/tom-ludwig/allinorfold/blob/main/src/test/kotlin/hwr/oop/group1/poker/HandRankTest.kt"
    click PlayerTest "https://github.com/tom-ludwig/allinorfold/blob/main/src/test/kotlin/hwr/oop/group1/poker/PlayerTest.kt"
    click RoundTest "https://github.com/tom-ludwig/allinorfold/blob/main/src/test/kotlin/hwr/oop/group1/poker/RoundTest.kt"

    %% Styles
    classDef presentation fill:#BEE3F8,stroke:#3182CE,color:#1A365D;
    classDef application fill:#C6F6D5,stroke:#2F855A,color:#22543D;
    classDef domain fill:#FEFCBF,stroke:#D69E2E,color:#744210;
    classDef infra fill:#E2E8F0,stroke:#4A5568,color:#2D3748;
    classDef external fill:#F0FFF4,stroke:#38A169,color:#22543D;
```
