# joonasmartinez/jogo-da-velha architecture

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

- Interactive diagram: https://gitdiagram.com/joonasmartinez/jogo-da-velha
- Repository: https://github.com/joonasmartinez/jogo-da-velha

## Overview

Um jogo da velha no navegador: a pessoa escolhe casas, o JavaScript valida as jogadas e alterna os turnos, verifica vitória ou empate e atualiza o placar. Opcionalmente, a IA escolhe uma jogada após o turno de X. O README documenta a interface e esses recursos; a árvore e o trecho de código não mostram como o HTML carrega o JavaScript, então essa ligação não é inferida.

Main entry points: [`functions.js`](https://github.com/joonasmartinez/jogo-da-velha/blob/main/functions.js) (Fluxo da partida), [`index.html`](https://github.com/joonasmartinez/jogo-da-velha/blob/main/index.html) (Tabuleiro e controles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Interface"]
  node_page["Tabuleiro e controles<br/>[index.html]"]
  node_styles["Estilos<br/>[estilo.css]"]
end

subgraph group_game["Regras do jogo"]
  node_engine["Fluxo da partida<br/>[functions.js]"]
  node_rules["Vitória e empate<br/>[functions.js]"]
  node_score["Placar<br/>[functions.js]"]
end

subgraph group_computer["Jogador IA"]
  node_ai["Escolha de jogada<br/>[functions.js]"]
end

node_person(("Pessoa jogadora"))

node_person -->|"interage"| node_page
node_engine -->|"lê e atualiza"| node_page
node_engine -->|"verifica jogada"| node_rules
node_engine -->|"atualiza resultado"| node_score
node_engine -->|"solicita jogada"| node_ai
node_ai -->|"lê casas e clica"| node_page

click node_page "https://github.com/joonasmartinez/jogo-da-velha/blob/main/index.html"
click node_styles "https://github.com/joonasmartinez/jogo-da-velha/blob/main/estilo.css"
click node_engine "https://github.com/joonasmartinez/jogo-da-velha/blob/main/functions.js"
click node_rules "https://github.com/joonasmartinez/jogo-da-velha/blob/main/functions.js"
click node_score "https://github.com/joonasmartinez/jogo-da-velha/blob/main/functions.js"
click node_ai "https://github.com/joonasmartinez/jogo-da-velha/blob/main/functions.js"

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_page,node_styles toneBlue
class node_engine,node_rules,node_score toneAmber
class node_ai toneMint
class node_person toneIndigo
```

## Components

### Interface

- [Tabuleiro e controles](https://github.com/joonasmartinez/jogo-da-velha/blob/main/index.html): `index.html`
- [Estilos](https://github.com/joonasmartinez/jogo-da-velha/blob/main/estilo.css): `estilo.css`

### Regras do jogo

- [Fluxo da partida](https://github.com/joonasmartinez/jogo-da-velha/blob/main/functions.js): `functions.js`
- [Vitória e empate](https://github.com/joonasmartinez/jogo-da-velha/blob/main/functions.js): `functions.js`
- [Placar](https://github.com/joonasmartinez/jogo-da-velha/blob/main/functions.js): `functions.js`

### Jogador IA

- [Escolha de jogada](https://github.com/joonasmartinez/jogo-da-velha/blob/main/functions.js): `functions.js`

### Other components

- **Pessoa jogadora**

## Connections

- Pessoa jogadora → Tabuleiro e controles: interage
- Fluxo da partida → Tabuleiro e controles: lê e atualiza
- Fluxo da partida → Vitória e empate: verifica jogada
- Fluxo da partida → Placar: atualiza resultado
- Fluxo da partida → Escolha de jogada: solicita jogada
- Escolha de jogada → Tabuleiro e controles: lê casas e clica
