# elyes-ghouma/bac-surprise architecture

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

- Interactive diagram: https://gitdiagram.com/elyes-ghouma/bac-surprise
- Repository: https://github.com/elyes-ghouma/bac-surprise

## Overview

SMS Results Reveal is a Windows desktop grade-reveal game. The user saves a target average; the app polls Gmail for a matching forwarded SMS, checks its fields, and launches the fullscreen interface when a matching email is found. The interface parses the SMS, compares its average with the saved target, then offers grade guesses, hints, skips, and an average reveal. The graph follows documented and excerpted behavior; generated runtime files not present in the tree are represented by the code that writes or reads them.

Main entry points: [`main.py`](https://github.com/elyes-ghouma/bac-surprise/blob/master/main.py) (Poll and launch), [`mailforw.py`](https://github.com/elyes-ghouma/bac-surprise/blob/master/mailforw.py) (Mail filter), [`interface.py`](https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py) (Fullscreen interface), [`search.py`](https://github.com/elyes-ghouma/bac-surprise/blob/master/search.py) (SMS field check)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["SMS intake"]
  node_launcher["Poll and launch<br/>[main.py]"]
  node_mail_filter["Mail filter<br/>[mailforw.py]"]
  node_field_check["SMS field check<br/>[search.py]"]
end

subgraph group_state["Grade data"]
  node_instructions["SMS field list<br/>[inst.txt]"]
  node_sms_archive["Forwarded SMS text<br/>[mailforw.py]"]
  node_target_average["Saved average<br/>[main.py]"]
  node_parser["SMS parser<br/>[interface.py]"]
  node_grade_data["Parsed grade data<br/>[data.dat]"]
end

subgraph group_game["Reveal game"]
  node_threshold_check["Average comparison<br/>[interface.py]"]
  node_game_screen["Fullscreen interface<br/>[interface.py]"]
  node_guess_round["Guess and hints<br/>[interface.py]"]
  node_average_reveal["Average reveal<br/>[interface.py]"]
end

node_user(("User"))
node_gmail["Gmail IMAP"]

node_user -->|"enters target"| node_launcher
node_launcher -->|"saves target"| node_target_average
node_launcher -->|"polls mail"| node_mail_filter
node_mail_filter -->|"checks inbox"| node_gmail
node_mail_filter -->|"validates SMS"| node_field_check
node_field_check -->|"reads fields"| node_instructions
node_mail_filter -->|"appends SMS"| node_sms_archive
node_launcher -->|"launches interface"| node_game_screen
node_parser -->|"reads latest SMS"| node_sms_archive
node_parser -->|"reads fields"| node_instructions
node_parser -->|"writes parsed grades"| node_grade_data
node_threshold_check -->|"reads average"| node_grade_data
node_threshold_check -->|"reads target"| node_target_average
node_user -->|"starts game"| node_game_screen
node_game_screen -->|"offers guessing"| node_guess_round
node_guess_round -->|"skips to reveal"| node_average_reveal
node_user -->|"guesses or skips"| node_guess_round
node_game_screen -->|"reveals average"| node_average_reveal

click node_launcher "https://github.com/elyes-ghouma/bac-surprise/blob/master/main.py"
click node_mail_filter "https://github.com/elyes-ghouma/bac-surprise/blob/master/mailforw.py"
click node_field_check "https://github.com/elyes-ghouma/bac-surprise/blob/master/search.py"
click node_instructions "https://github.com/elyes-ghouma/bac-surprise/blob/master/inst.txt"
click node_sms_archive "https://github.com/elyes-ghouma/bac-surprise/blob/master/mailforw.py"
click node_target_average "https://github.com/elyes-ghouma/bac-surprise/blob/master/main.py"
click node_parser "https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py"
click node_grade_data "https://github.com/elyes-ghouma/bac-surprise/blob/master/data.dat"
click node_threshold_check "https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py"
click node_game_screen "https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py"
click node_guess_round "https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py"
click node_average_reveal "https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py"

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_launcher,node_mail_filter,node_field_check,node_user toneBlue
class node_instructions,node_sms_archive,node_target_average,node_parser,node_grade_data toneAmber
class node_threshold_check,node_game_screen,node_guess_round,node_average_reveal toneMint
class node_gmail toneIndigo
```

## Components

### SMS intake

- [Poll and launch](https://github.com/elyes-ghouma/bac-surprise/blob/master/main.py): `main.py`
- [Mail filter](https://github.com/elyes-ghouma/bac-surprise/blob/master/mailforw.py): `mailforw.py`
- [SMS field check](https://github.com/elyes-ghouma/bac-surprise/blob/master/search.py): `search.py`

### Grade data

- [SMS field list](https://github.com/elyes-ghouma/bac-surprise/blob/master/inst.txt): `inst.txt`
- [Forwarded SMS text](https://github.com/elyes-ghouma/bac-surprise/blob/master/mailforw.py): `mailforw.py`
- [Saved average](https://github.com/elyes-ghouma/bac-surprise/blob/master/main.py): `main.py`
- [SMS parser](https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py): `interface.py`
- [Parsed grade data](https://github.com/elyes-ghouma/bac-surprise/blob/master/data.dat): `data.dat`

### Reveal game

- [Average comparison](https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py): `interface.py`
- [Fullscreen interface](https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py): `interface.py`
- [Guess and hints](https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py): `interface.py`
- [Average reveal](https://github.com/elyes-ghouma/bac-surprise/blob/master/interface.py): `interface.py`

### Other components

- **User**
- **Gmail IMAP**

## Connections

- User → Poll and launch: enters target (evidence: `README.md`)
- Poll and launch → Saved average: saves target (evidence: `main.py`)
- Poll and launch → Mail filter: polls mail (evidence: `main.py`)
- Mail filter → Gmail IMAP: checks inbox (evidence: `mailforw.py`)
- Mail filter → SMS field check: validates SMS (evidence: `mailforw.py`)
- SMS field check → SMS field list: reads fields (evidence: `search.py`)
- Mail filter → Forwarded SMS text: appends SMS (evidence: `mailforw.py`)
- Poll and launch → Fullscreen interface: launches interface (evidence: `main.py`)
- SMS parser → Forwarded SMS text: reads latest SMS (evidence: `README.md`)
- SMS parser → SMS field list: reads fields (evidence: `interface.py`)
- SMS parser → Parsed grade data: writes parsed grades (evidence: `interface.py`)
- Average comparison → Parsed grade data: reads average (evidence: `interface.py`)
- Average comparison → Saved average: reads target (evidence: `README.md`)
- User → Fullscreen interface: starts game (evidence: `README.md`)
- Fullscreen interface → Guess and hints: offers guessing (evidence: `interface.py`)
- Guess and hints → Average reveal: skips to reveal (evidence: `interface.py`)
- User → Guess and hints: guesses or skips (evidence: `README.md`)
- Fullscreen interface → Average reveal: reveals average (evidence: `README.md`)
