# byfranca/desafios_java architecture

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

- Interactive diagram: https://gitdiagram.com/byfranca/desafios_java
- Repository: https://github.com/byfranca/desafios_java

## Overview

This repository is a small collection of independent Java programs: a theatre seat reservation and sales application, a Swing tic-tac-toe game, and five console exercises. In the theatre workflow, the user enters a ticket price, selects an action, clicks seats, and can view seat counts and financial totals. Tic-tac-toe lets players choose who starts, make moves, see wins or draws and scores, and restart. The sampled code places most behaviour directly in each Swing screen; the README documents theatre capabilities. Arrows reflect shown calls or documented interactions, not separate unseen layers.

Main entry points: [`src/teatro_swing/TelaTeatro.java`](https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java) (Theatre screen), [`src/jogo_da_velha_swing/TelaJogoDaVelha.java`](https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/TelaJogoDaVelha.java) (Game screen), [`src/teatro_swing/Main.java`](https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/Main.java) (Theatre launcher), [`src/jogo_da_velha_swing/Main.java`](https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/Main.java) (Game launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_theatre["Theatre reservations"]
  node_theatre_main["Theatre launcher<br/>[Main.java]"]
  node_theatre_screen["Theatre screen<br/>[TelaTeatro.java]"]
  node_seat_grid["Seat grid and state<br/>[TelaTeatro.java]"]
  node_seat_actions["Seat actions<br/>[TelaTeatro.java]"]
  node_pricing["Ticket pricing<br/>[TelaTeatro.java]"]
  node_finance["Financial report<br/>[TelaTeatro.java]"]
end

subgraph group_game["Tic-tac-toe"]
  node_game_main["Game launcher<br/>[Main.java]"]
  node_game_screen["Game screen"]
  node_gameplay["Move and win logic"]
  node_score_restart["Score and restart"]
end

subgraph group_exercises["Console exercises"]
  node_console_programs["Console exercises"]
end

node_user(("User"))

node_user -.->|"starts"| node_theatre_main
node_theatre_main -->|"creates"| node_theatre_screen
node_user -.->|"uses"| node_theatre_screen
node_theatre_screen -->|"requests price"| node_pricing
node_theatre_screen -->|"displays seats"| node_seat_grid
node_user -->|"selects action"| node_seat_actions
node_user -->|"chooses seats"| node_seat_grid
node_seat_actions -->|"updates state"| node_seat_grid
node_theatre_screen -->|"shows report"| node_finance
node_user -->|"requests report"| node_finance
node_user -.->|"starts"| node_game_main
node_game_main -->|"creates"| node_game_screen
node_user -.->|"plays"| node_game_screen
node_game_screen -->|"handles moves"| node_gameplay
node_gameplay -->|"updates score"| node_score_restart
node_user -->|"restarts game"| node_score_restart
node_user -.->|"runs"| node_console_programs

click node_theatre_main "https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/Main.java"
click node_theatre_screen "https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java"
click node_seat_grid "https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java"
click node_seat_actions "https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java"
click node_pricing "https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java"
click node_finance "https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java"
click node_game_main "https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/Main.java"
click node_game_screen "https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/TelaJogoDaVelha.java"
click node_gameplay "https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/TelaJogoDaVelha.java"
click node_score_restart "https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/TelaJogoDaVelha.java"
click node_console_programs "https://github.com/byfranca/desafios_java/tree/main/src/exercicios_simples"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_theatre_main,node_theatre_screen,node_seat_grid,node_seat_actions,node_pricing,node_finance,node_user toneBlue
class node_game_main,node_game_screen,node_gameplay,node_score_restart toneAmber
class node_console_programs toneMint
```

## Components

### Theatre reservations

- [Theatre launcher](https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/Main.java): `src/teatro_swing/Main.java`
- [Theatre screen](https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java): `src/teatro_swing/TelaTeatro.java`
- [Seat grid and state](https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java): `src/teatro_swing/TelaTeatro.java`
- [Seat actions](https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java): `src/teatro_swing/TelaTeatro.java`
- [Ticket pricing](https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java): `src/teatro_swing/TelaTeatro.java`
- [Financial report](https://github.com/byfranca/desafios_java/blob/main/src/teatro_swing/TelaTeatro.java): `src/teatro_swing/TelaTeatro.java`

### Tic-tac-toe

- [Game launcher](https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/Main.java): `src/jogo_da_velha_swing/Main.java`
- [Game screen](https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/TelaJogoDaVelha.java): `src/jogo_da_velha_swing/TelaJogoDaVelha.java`
- [Move and win logic](https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/TelaJogoDaVelha.java): `src/jogo_da_velha_swing/TelaJogoDaVelha.java`
- [Score and restart](https://github.com/byfranca/desafios_java/blob/main/src/jogo_da_velha_swing/TelaJogoDaVelha.java): `src/jogo_da_velha_swing/TelaJogoDaVelha.java`

### Console exercises

- [Console exercises](https://github.com/byfranca/desafios_java/tree/main/src/exercicios_simples): `src/exercicios_simples`

### Other components

- **User**

## Connections

- User → Theatre launcher: starts
- Theatre launcher → Theatre screen: creates (evidence: `src/teatro_swing/Main.java`)
- User → Theatre screen: uses (evidence: `README.md`)
- Theatre screen → Ticket pricing: requests price (evidence: `src/teatro_swing/TelaTeatro.java`)
- Theatre screen → Seat grid and state: displays seats (evidence: `src/teatro_swing/TelaTeatro.java`)
- User → Seat actions: selects action (evidence: `README.md`)
- User → Seat grid and state: chooses seats (evidence: `README.md`)
- Seat actions → Seat grid and state: updates state (evidence: `README.md`)
- Theatre screen → Financial report: shows report (evidence: `src/teatro_swing/TelaTeatro.java`)
- User → Financial report: requests report (evidence: `README.md`)
- User → Game launcher: starts
- Game launcher → Game screen: creates (evidence: `src/jogo_da_velha_swing/Main.java`)
- User → Game screen: plays
- Game screen → Move and win logic: handles moves (evidence: `src/jogo_da_velha_swing/TelaJogoDaVelha.java`)
- Move and win logic → Score and restart: updates score (evidence: `src/jogo_da_velha_swing/TelaJogoDaVelha.java`)
- User → Score and restart: restarts game (evidence: `src/jogo_da_velha_swing/TelaJogoDaVelha.java`)
- User → Console exercises: runs
