# bzitko/bis architecture

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

- Interactive diagram: https://gitdiagram.com/bzitko/bis
- Repository: https://github.com/bzitko/bis

## Overview

This is a terminal version of a two-round word-and-numbers game. The principal workflow is player setup and turn management, followed by generating a challenge, collecting and validating player input, awarding points, and continuing or ending the game. The letters round uses a Croatian lexicon and language-model support; the numbers round generates operands and evaluates arithmetic solutions. The excerpts establish the main game/model responsibilities, but do not show all imports or asset-loading configuration, so uncertain UI and data wiring is omitted.

Main entry points: [`game.py`](https://github.com/bzitko/bis/blob/main/game.py) (Game coordinator), [`model_letters.py`](https://github.com/bzitko/bis/blob/main/model_letters.py) (Letters model), [`view.py`](https://github.com/bzitko/bis/blob/main/view.py) (Terminal view), [`view_ansi.py`](https://github.com/bzitko/bis/blob/main/view_ansi.py) (ANSI view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game flow"]
  node_game["Game coordinator<br/>[game.py]"]
  node_letters_turn["Letters turn<br/>[game.py]"]
  node_numbers_turn["Numbers turn<br/>[game.py]"]
  node_text_view["Terminal view<br/>[view.py]"]
  node_ansi_view["ANSI view<br/>[view_ansi.py]"]
end

subgraph group_letters["Letters round"]
  node_letters_model["Letters model<br/>[model_letters.py]"]
  node_language_model["Language model<br/>[languagemodel4.txt]"]
end

subgraph group_numbers["Numbers round"]
  node_numbers_model["Numbers model<br/>[model_numbers.py]"]
end

subgraph group_language["Language data"]
  node_lexicon["Lexicon model<br/>[model_language.py]"]
  node_lex_data["Lexicon data<br/>[hml.csv]"]
  node_morph_spec["Morphology specs<br/>[morphspec.txt]"]
end

node_player(("Players"))

node_player -->|"starts game"| node_game
node_game -->|"collects setup"| node_text_view
node_game -->|"runs turn"| node_letters_turn
node_game -->|"runs turn"| node_numbers_turn
node_game -->|"shows scores"| node_text_view
node_letters_turn -->|"generates and validates"| node_letters_model
node_letters_turn -->|"gets input, shows round"| node_text_view
node_numbers_turn -->|"generates and evaluates"| node_numbers_model
node_numbers_turn -->|"gets input, shows round"| node_text_view
node_letters_model -->|"uses language methods"| node_lexicon
node_letters_model -->|"loads model"| node_language_model
node_letters_model -->|"loads lexicon"| node_lex_data
node_letters_model -->|"loads specifications"| node_morph_spec
node_ansi_view -->|"extends terminal UI"| node_text_view

click node_game "https://github.com/bzitko/bis/blob/main/game.py"
click node_letters_turn "https://github.com/bzitko/bis/blob/main/game.py"
click node_numbers_turn "https://github.com/bzitko/bis/blob/main/game.py"
click node_text_view "https://github.com/bzitko/bis/blob/main/view.py"
click node_ansi_view "https://github.com/bzitko/bis/blob/main/view_ansi.py"
click node_letters_model "https://github.com/bzitko/bis/blob/main/model_letters.py"
click node_lexicon "https://github.com/bzitko/bis/blob/main/model_language.py"
click node_language_model "https://github.com/bzitko/bis/blob/main/languagemodel4.txt"
click node_lex_data "https://github.com/bzitko/bis/blob/main/hml.csv"
click node_morph_spec "https://github.com/bzitko/bis/blob/main/morphspec.txt"
click node_numbers_model "https://github.com/bzitko/bis/blob/main/model_numbers.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_game,node_letters_turn,node_numbers_turn,node_text_view,node_ansi_view toneBlue
class node_letters_model,node_language_model toneAmber
class node_numbers_model toneMint
class node_lexicon,node_lex_data,node_morph_spec toneRose
class node_player toneIndigo
```

## Components

### Game flow

- [Game coordinator](https://github.com/bzitko/bis/blob/main/game.py): `game.py`
- [Letters turn](https://github.com/bzitko/bis/blob/main/game.py): `game.py`
- [Numbers turn](https://github.com/bzitko/bis/blob/main/game.py): `game.py`
- [Terminal view](https://github.com/bzitko/bis/blob/main/view.py): `view.py`
- [ANSI view](https://github.com/bzitko/bis/blob/main/view_ansi.py): `view_ansi.py`

### Letters round

- [Letters model](https://github.com/bzitko/bis/blob/main/model_letters.py): `model_letters.py`
- [Language model](https://github.com/bzitko/bis/blob/main/languagemodel4.txt): `languagemodel4.txt`

### Numbers round

- [Numbers model](https://github.com/bzitko/bis/blob/main/model_numbers.py): `model_numbers.py`

### Language data

- [Lexicon model](https://github.com/bzitko/bis/blob/main/model_language.py): `model_language.py`
- [Lexicon data](https://github.com/bzitko/bis/blob/main/hml.csv): `hml.csv`
- [Morphology specs](https://github.com/bzitko/bis/blob/main/morphspec.txt): `morphspec.txt`

### Other components

- **Players**

## Connections

- Players → Game coordinator: starts game
- Game coordinator → Terminal view: collects setup
- Game coordinator → Letters turn: runs turn
- Game coordinator → Numbers turn: runs turn
- Game coordinator → Terminal view: shows scores
- Letters turn → Letters model: generates and validates
- Letters turn → Terminal view: gets input, shows round
- Numbers turn → Numbers model: generates and evaluates
- Numbers turn → Terminal view: gets input, shows round
- Letters model → Lexicon model: uses language methods
- Letters model → Language model: loads model
- Letters model → Lexicon data: loads lexicon
- Letters model → Morphology specs: loads specifications
- ANSI view → Terminal view: extends terminal UI
