# maramani/pop-it architecture

> Architecture diagram of the GitHub repository maramani/pop-it, 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/maramani/pop-it
- Repository: https://github.com/maramani/pop-it

## Overview

Pop-it is a two-player, turn-based console game: the user opts in, chooses a row layout, and then players alternate removing objects until the game-ending condition is reached. The main script coordinates setup and play; game logic handles layout creation, display, move selection and validation, and state updates. The shared row counts live in an in-memory dictionary, not a persistent store. The relationships shown are supported by the supplied excerpts; the README also documents 7-5-3 and square layouts, but does not identify separate implementations for them.

Main entry points: [`myfunctions.py`](https://github.com/maramani/pop-it/blob/main/myfunctions.py) (Turn loop), [`main.py`](https://github.com/maramani/pop-it/blob/main/main.py) (Game entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flow["Game flow"]
  node_entry["Game entry<br/>[main.py]"]
  node_turns["Turn loop<br/>[myfunctions.py]"]
end

subgraph group_rules["Rules and state"]
  node_setup["Layout setup<br/>[myfunctions.py]"]
  node_display["Board display<br/>[myfunctions.py]"]
  node_selection["Move selection<br/>[myfunctions.py]"]
  node_state["Row state<br/>[myfunctions.py]"]
end

node_player(("Player"))

node_player -->|"starts and responds"| node_entry
node_entry -->|"calls setup"| node_setup
node_entry -->|"starts play"| node_turns
node_setup -->|"requests layout"| node_player
node_setup -->|"sets row counts"| node_state
node_turns -->|"prints board"| node_display
node_display -->|"reads row counts"| node_state
node_turns -->|"requests move"| node_selection
node_selection -->|"requests row and count"| node_player
node_selection -->|"checks row counts"| node_state
node_turns -->|"updates row counts"| node_state
node_turns -->|"recurses next turn"| node_turns

click node_entry "https://github.com/maramani/pop-it/blob/main/main.py"
click node_setup "https://github.com/maramani/pop-it/blob/main/myfunctions.py"
click node_turns "https://github.com/maramani/pop-it/blob/main/myfunctions.py"
click node_display "https://github.com/maramani/pop-it/blob/main/myfunctions.py"
click node_selection "https://github.com/maramani/pop-it/blob/main/myfunctions.py"
click node_state "https://github.com/maramani/pop-it/blob/main/myfunctions.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_entry,node_turns toneBlue
class node_setup,node_display,node_selection,node_state toneAmber
class node_player toneIndigo
```

## Components

### Game flow

- [Game entry](https://github.com/maramani/pop-it/blob/main/main.py): `main.py`
- [Turn loop](https://github.com/maramani/pop-it/blob/main/myfunctions.py): `myfunctions.py`

### Rules and state

- [Layout setup](https://github.com/maramani/pop-it/blob/main/myfunctions.py): `myfunctions.py`
- [Board display](https://github.com/maramani/pop-it/blob/main/myfunctions.py): `myfunctions.py`
- [Move selection](https://github.com/maramani/pop-it/blob/main/myfunctions.py): `myfunctions.py`
- [Row state](https://github.com/maramani/pop-it/blob/main/myfunctions.py): `myfunctions.py`

### Other components

- **Player**

## Connections

- Player → Game entry: starts and responds (evidence: `main.py`)
- Game entry → Layout setup: calls setup (evidence: `main.py`)
- Game entry → Turn loop: starts play (evidence: `main.py`)
- Layout setup → Player: requests layout (evidence: `myfunctions.py`)
- Layout setup → Row state: sets row counts (evidence: `myfunctions.py`)
- Turn loop → Board display: prints board (evidence: `myfunctions.py`)
- Board display → Row state: reads row counts (evidence: `myfunctions.py`)
- Turn loop → Move selection: requests move (evidence: `myfunctions.py`)
- Move selection → Player: requests row and count (evidence: `myfunctions.py`)
- Move selection → Row state: checks row counts (evidence: `myfunctions.py`)
- Turn loop → Row state: updates row counts (evidence: `myfunctions.py`)
- Turn loop → Turn loop: recurses next turn (evidence: `myfunctions.py`)
