# bnk0dev/oyunteorisi architecture

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

- Interactive diagram: https://gitdiagram.com/bnk0dev/oyunteorisi
- Repository: https://github.com/bnk0dev/oyunteorisi

## Overview

##### Project type and purpose
- This is a simple command-line Java application (“oyunTeorisi”) that simulates a two-player iterative game (trust vs. betray) where each player starts at 0 points and races to 10 points. The core functionality lives in a single Java source file (`game.java`).

##### File structure
- Top-level:
- README.md – project description and rules
- game.java – all code (game loop, input handling, scoring logic, end-condition)
- No separate frontend/backend, no external dependencies, no configuration or build scripts beyond a standard `javac`/`java` invocation.

##### README for additional insights
- Rules for scoring:
- Both trust → +2 each
- One betrays → betrayer +3, betrayed −1
- Both betray → no points
- Goal: first to 10 points wins

a. Main components
1. Command-Line Interface (CLI) – reads player input and displays results
2. Game Engine – orchestrates rounds, applies game rules
3. Score Manager – computes and updates scores based on decisions
4. Player Entities – two instances representing “You” and “Opponent”
5. Termination Checker – determines if a player has reached 10 points
b. Relationships and interactions
- The CLI passes decisions to the Game Engine each round
- Game Engine invokes the Score Manager with both decisions
- Score Manager returns updated scores to the Game Engine
- Game Engine updates Player Entities and calls the Termination Checker
- If no winner, loop back to CLI for the next round; otherwise CLI displays the winner
c. Architectural patterns/design principles
- Separation of concerns:
- Input/Output (CLI) vs. core logic (Game Engine) vs. scoring rules (Score Manager)
- Single-threaded, synchronous loop
d. Key technologies
- Java SE standard libraries (java.util.Scanner for input)
- No external frameworks or databases

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Command-Line Interface"
        CLI["CLI"]:::io
    end

    subgraph "Game Engine"
        GE["Game Engine"]:::logic
    end

    subgraph "Score Manager"
        SM["Score Manager"]:::score
        DM{Decision<br/>Branch}:::score
    end

    subgraph "Termination Checker"
        TC["Termination Checker"]:::logic
    end

    subgraph "Player Entities"
        P1["Player: You"]:::data
        P2["Player: Opponent"]:::data
    end

    README["README.md"]:::doc

    CLI -->|"decision pair"| GE
    GE -->|"invoke scoring"| SM
    SM -->|"evaluate rules"| DM
    DM -->|"trust/trust: +2,+2"| GE
    DM -->|"trust/betray: +3,-1"| GE
    DM -->|"betray/betray: +0,+0"| GE
    GE -->|"win? true/false"| TC
    TC -->|"false: next round"| CLI
    TC -->|"true: display winner"| CLI

    %% Click Events
    click CLI "https://github.com/bnk0dev/oyunteorisi/blob/main/game.java"
    click GE "https://github.com/bnk0dev/oyunteorisi/blob/main/game.java"
    click SM "https://github.com/bnk0dev/oyunteorisi/blob/main/game.java"
    click DM "https://github.com/bnk0dev/oyunteorisi/blob/main/game.java"
    click TC "https://github.com/bnk0dev/oyunteorisi/blob/main/game.java"
    click P1 "https://github.com/bnk0dev/oyunteorisi/blob/main/game.java"
    click P2 "https://github.com/bnk0dev/oyunteorisi/blob/main/game.java"
    click README "https://github.com/bnk0dev/oyunteorisi/blob/main/README.md"

    %% Styles
    classDef io fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#000,stroke-width:1px
    classDef score fill:#FFA500,stroke:#000,stroke-width:1px
    classDef data fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef doc fill:#F0F0F0,stroke:#000,stroke-width:1px
```
