# filiph/tictactoe architecture

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

- Interactive diagram: https://gitdiagram.com/filiph/tictactoe
- Repository: https://github.com/filiph/tictactoe

## Overview

This repository is a Flutter tic-tac-toe puzzle game for mobile, with web demos. The intended player journey is app entry, menu, level selection, play against an opponent, then a win/result screen. The tree also shows settings and progress state, plus audio, ads, purchases, game services, and crash reporting. Dart implementation excerpts were not provided, so gameplay and service connections are shown as dashed, unverified relationships; the sampled macOS window-to-plugin registration is supported by source.

Main entry points: [`lib/src/main_menu/main_menu_screen.dart`](https://github.com/filiph/tictactoe/blob/main/lib/src/main_menu/main_menu_screen.dart) (Main menu), [`lib/src/play_session/play_session_screen.dart`](https://github.com/filiph/tictactoe/blob/main/lib/src/play_session/play_session_screen.dart) (Play session), [`lib/main.dart`](https://github.com/filiph/tictactoe/blob/main/lib/main.dart) (App entry), [`lib/src/ai/ai_opponent.dart`](https://github.com/filiph/tictactoe/blob/main/lib/src/ai/ai_opponent.dart) (AI opponents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Player experience"]
  node_app["App entry<br/>[main.dart]"]
  node_menu["Main menu"]
  node_levels["Level selection"]
  node_play["Play session"]
  node_board["Game board<br/>[game_board.dart]"]
  node_win["Win screen"]
end

subgraph group_gameplay["Game logic"]
  node_boardstate["Board state<br/>[board_state.dart]"]
  node_tile["Board tiles<br/>[tile.dart]"]
  node_boardsettings["Board settings<br/>[board_setting.dart]"]
  node_opponents["AI opponents<br/>[ai_opponent.dart]"]
  node_randomai["Random opponent"]
  node_scoringai["Scoring opponent"]
  node_humanai["Humanlike opponent"]
end

subgraph group_state["Player state"]
  node_progress["Player progress"]
  node_progressstore["Progress persistence"]
  node_settings["Settings<br/>[settings.dart]"]
  node_settingsstore["Settings persistence"]
end

subgraph group_services["Game services"]
  node_audio["Audio controller"]
  node_ads["Ads controller"]
  node_purchase["In-app purchase"]
  node_gameservices["Game services"]
  node_crash["Crash reporting<br/>[crashlytics.dart]"]
  node_lifecycle["App lifecycle<br/>[app_lifecycle.dart]"]
end

subgraph group_platform["Platform integration"]
  node_window["macOS Flutter window"]
  node_plugins["Plugin registration"]
end

node_player(("Player"))

node_player -.->|"launches"| node_app
node_app -.->|"opens"| node_menu
node_menu -.->|"selects level"| node_levels
node_levels -.->|"starts game"| node_play
node_play -.->|"shows board"| node_board
node_board -.->|"uses state"| node_boardstate
node_board -.->|"renders tiles"| node_tile
node_play -.->|"uses opponent"| node_opponents
node_opponents -.->|"selects strategy"| node_randomai
node_opponents -.->|"selects strategy"| node_scoringai
node_opponents -.->|"selects strategy"| node_humanai
node_play -.->|"shows result"| node_win
node_levels -.->|"uses progress"| node_progress
node_progress -.->|"persists progress"| node_progressstore
node_menu -.->|"opens settings"| node_settings
node_settings -.->|"persists settings"| node_settingsstore
node_play -.->|"plays audio"| node_audio
node_menu -.->|"displays ads"| node_ads
node_menu -.->|"offers purchase"| node_purchase
node_win -.->|"reports score"| node_gameservices
node_app -.->|"reports crashes"| node_crash
node_app -.->|"tracks lifecycle"| node_lifecycle
node_window -->|"registers plugins"| node_plugins

click node_app "https://github.com/filiph/tictactoe/blob/main/lib/main.dart"
click node_menu "https://github.com/filiph/tictactoe/blob/main/lib/src/main_menu/main_menu_screen.dart"
click node_levels "https://github.com/filiph/tictactoe/blob/main/lib/src/level_selection/level_selection_screen.dart"
click node_play "https://github.com/filiph/tictactoe/blob/main/lib/src/play_session/play_session_screen.dart"
click node_board "https://github.com/filiph/tictactoe/blob/main/lib/src/play_session/game_board.dart"
click node_win "https://github.com/filiph/tictactoe/blob/main/lib/src/win_game/win_game_screen.dart"
click node_boardstate "https://github.com/filiph/tictactoe/blob/main/lib/src/game_internals/board_state.dart"
click node_tile "https://github.com/filiph/tictactoe/blob/main/lib/src/game_internals/tile.dart"
click node_boardsettings "https://github.com/filiph/tictactoe/blob/main/lib/src/game_internals/board_setting.dart"
click node_opponents "https://github.com/filiph/tictactoe/blob/main/lib/src/ai/ai_opponent.dart"
click node_randomai "https://github.com/filiph/tictactoe/blob/main/lib/src/ai/random_opponent.dart"
click node_scoringai "https://github.com/filiph/tictactoe/blob/main/lib/src/ai/scoring_opponent.dart"
click node_humanai "https://github.com/filiph/tictactoe/blob/main/lib/src/ai/humanlike_opponent.dart"
click node_progress "https://github.com/filiph/tictactoe/blob/main/lib/src/player_progress/player_progress.dart"
click node_progressstore "https://github.com/filiph/tictactoe/blob/main/lib/src/player_progress/persistence/local_storage_player_progress_persistence.dart"
click node_settings "https://github.com/filiph/tictactoe/blob/main/lib/src/settings/settings.dart"
click node_settingsstore "https://github.com/filiph/tictactoe/blob/main/lib/src/settings/persistence/local_storage_settings_persistence.dart"
click node_audio "https://github.com/filiph/tictactoe/blob/main/lib/src/audio/audio_controller.dart"
click node_ads "https://github.com/filiph/tictactoe/blob/main/lib/src/ads/ads_controller.dart"
click node_purchase "https://github.com/filiph/tictactoe/blob/main/lib/src/in_app_purchase/in_app_purchase.dart"
click node_gameservices "https://github.com/filiph/tictactoe/blob/main/lib/src/games_services/games_services.dart"
click node_crash "https://github.com/filiph/tictactoe/blob/main/lib/src/crashlytics/crashlytics.dart"
click node_lifecycle "https://github.com/filiph/tictactoe/blob/main/lib/src/app_lifecycle/app_lifecycle.dart"
click node_window "https://github.com/filiph/tictactoe/blob/main/macos/Runner/MainFlutterWindow.swift"
click node_plugins "https://github.com/filiph/tictactoe/blob/main/macos/Flutter/GeneratedPluginRegistrant.swift"

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_app,node_menu,node_levels,node_play,node_board,node_win toneBlue
class node_boardstate,node_tile,node_boardsettings,node_opponents,node_randomai,node_scoringai,node_humanai toneAmber
class node_progress,node_progressstore,node_settings,node_settingsstore toneMint
class node_audio,node_ads,node_purchase,node_gameservices,node_crash,node_lifecycle toneRose
class node_window,node_plugins,node_player toneIndigo
```

## Components

### Player experience

- [App entry](https://github.com/filiph/tictactoe/blob/main/lib/main.dart): `lib/main.dart`
- [Main menu](https://github.com/filiph/tictactoe/blob/main/lib/src/main_menu/main_menu_screen.dart): `lib/src/main_menu/main_menu_screen.dart`
- [Level selection](https://github.com/filiph/tictactoe/blob/main/lib/src/level_selection/level_selection_screen.dart): `lib/src/level_selection/level_selection_screen.dart`
- [Play session](https://github.com/filiph/tictactoe/blob/main/lib/src/play_session/play_session_screen.dart): `lib/src/play_session/play_session_screen.dart`
- [Game board](https://github.com/filiph/tictactoe/blob/main/lib/src/play_session/game_board.dart): `lib/src/play_session/game_board.dart`
- [Win screen](https://github.com/filiph/tictactoe/blob/main/lib/src/win_game/win_game_screen.dart): `lib/src/win_game/win_game_screen.dart`

### Game logic

- [Board state](https://github.com/filiph/tictactoe/blob/main/lib/src/game_internals/board_state.dart): `lib/src/game_internals/board_state.dart`
- [Board tiles](https://github.com/filiph/tictactoe/blob/main/lib/src/game_internals/tile.dart): `lib/src/game_internals/tile.dart`
- [Board settings](https://github.com/filiph/tictactoe/blob/main/lib/src/game_internals/board_setting.dart): `lib/src/game_internals/board_setting.dart`
- [AI opponents](https://github.com/filiph/tictactoe/blob/main/lib/src/ai/ai_opponent.dart): `lib/src/ai/ai_opponent.dart`
- [Random opponent](https://github.com/filiph/tictactoe/blob/main/lib/src/ai/random_opponent.dart): `lib/src/ai/random_opponent.dart`
- [Scoring opponent](https://github.com/filiph/tictactoe/blob/main/lib/src/ai/scoring_opponent.dart): `lib/src/ai/scoring_opponent.dart`
- [Humanlike opponent](https://github.com/filiph/tictactoe/blob/main/lib/src/ai/humanlike_opponent.dart): `lib/src/ai/humanlike_opponent.dart`

### Player state

- [Player progress](https://github.com/filiph/tictactoe/blob/main/lib/src/player_progress/player_progress.dart): `lib/src/player_progress/player_progress.dart`
- [Progress persistence](https://github.com/filiph/tictactoe/blob/main/lib/src/player_progress/persistence/local_storage_player_progress_persistence.dart): `lib/src/player_progress/persistence/local_storage_player_progress_persistence.dart`
- [Settings](https://github.com/filiph/tictactoe/blob/main/lib/src/settings/settings.dart): `lib/src/settings/settings.dart`
- [Settings persistence](https://github.com/filiph/tictactoe/blob/main/lib/src/settings/persistence/local_storage_settings_persistence.dart): `lib/src/settings/persistence/local_storage_settings_persistence.dart`

### Game services

- [Audio controller](https://github.com/filiph/tictactoe/blob/main/lib/src/audio/audio_controller.dart): `lib/src/audio/audio_controller.dart`
- [Ads controller](https://github.com/filiph/tictactoe/blob/main/lib/src/ads/ads_controller.dart): `lib/src/ads/ads_controller.dart`
- [In-app purchase](https://github.com/filiph/tictactoe/blob/main/lib/src/in_app_purchase/in_app_purchase.dart): `lib/src/in_app_purchase/in_app_purchase.dart`
- [Game services](https://github.com/filiph/tictactoe/blob/main/lib/src/games_services/games_services.dart): `lib/src/games_services/games_services.dart`
- [Crash reporting](https://github.com/filiph/tictactoe/blob/main/lib/src/crashlytics/crashlytics.dart): `lib/src/crashlytics/crashlytics.dart`
- [App lifecycle](https://github.com/filiph/tictactoe/blob/main/lib/src/app_lifecycle/app_lifecycle.dart): `lib/src/app_lifecycle/app_lifecycle.dart`

### Platform integration

- [macOS Flutter window](https://github.com/filiph/tictactoe/blob/main/macos/Runner/MainFlutterWindow.swift): `macos/Runner/MainFlutterWindow.swift`
- [Plugin registration](https://github.com/filiph/tictactoe/blob/main/macos/Flutter/GeneratedPluginRegistrant.swift): `macos/Flutter/GeneratedPluginRegistrant.swift`

### Other components

- **Player**

## Connections

- Player → App entry: launches
- App entry → Main menu: opens
- Main menu → Level selection: selects level
- Level selection → Play session: starts game
- Play session → Game board: shows board
- Game board → Board state: uses state
- Game board → Board tiles: renders tiles
- Play session → AI opponents: uses opponent
- AI opponents → Random opponent: selects strategy
- AI opponents → Scoring opponent: selects strategy
- AI opponents → Humanlike opponent: selects strategy
- Play session → Win screen: shows result
- Level selection → Player progress: uses progress
- Player progress → Progress persistence: persists progress
- Main menu → Settings: opens settings
- Settings → Settings persistence: persists settings
- Play session → Audio controller: plays audio
- Main menu → Ads controller: displays ads
- Main menu → In-app purchase: offers purchase
- Win screen → Game services: reports score
- App entry → Crash reporting: reports crashes
- App entry → App lifecycle: tracks lifecycle
- macOS Flutter window → Plugin registration: registers plugins (evidence: `macos/Runner/MainFlutterWindow.swift`)
