# marctheduck/rock_paper_scissors_rs architecture

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

## Overview

This is a small terminal Rock Paper Scissors game. The user supplies a move, the game parses it and generates a computer move, compares them, updates and displays the running score, then asks whether to continue. The source shows the main loop and its calls; there is no README documentation.

Main entry points: [`src/main.rs`](https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/main.rs) (Game loop), [`src/rps.rs`](https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/rps.rs) (Moves and rules), [`src/utils.rs`](https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/utils.rs) (Terminal input), [`src/score.rs`](https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/score.rs) (Score state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game flow"]
  node_main["Game loop<br/>[main.rs]"]
  node_moves["Moves and rules<br/>[rps.rs]"]
end

subgraph group_support["Input and state"]
  node_score["Score state<br/>[score.rs]"]
  node_input["Terminal input<br/>[utils.rs]"]
end

node_player(("Player"))
node_rng["Random generator"]

node_player -->|"enters text"| node_input
node_main -->|"creates and updates"| node_score
node_main -->|"reads display"| node_score
node_main -->|"parses move"| node_moves
node_moves -->|"reads prompt"| node_input
node_main -->|"generates move"| node_moves
node_moves -->|"chooses randomly"| node_rng
node_main -->|"compares moves"| node_moves
node_main -->|"asks to continue"| node_input
node_input -->|"returns text"| node_player

click node_main "https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/main.rs"
click node_moves "https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/rps.rs"
click node_score "https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/score.rs"
click node_input "https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/utils.rs"

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_main,node_moves toneBlue
class node_score,node_input toneAmber
class node_player,node_rng toneIndigo
```

## Components

### Game flow

- [Game loop](https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/main.rs): `src/main.rs`
- [Moves and rules](https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/rps.rs): `src/rps.rs`

### Input and state

- [Score state](https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/score.rs): `src/score.rs`
- [Terminal input](https://github.com/marctheduck/rock_paper_scissors_rs/blob/master/src/utils.rs): `src/utils.rs`

### Other components

- **Player**
- **Random generator**

## Connections

- Player → Terminal input: enters text
- Game loop → Score state: creates and updates
- Game loop → Score state: reads display
- Game loop → Moves and rules: parses move
- Moves and rules → Terminal input: reads prompt
- Game loop → Moves and rules: generates move
- Moves and rules → Random generator: chooses randomly
- Game loop → Moves and rules: compares moves
- Game loop → Terminal input: asks to continue
- Terminal input → Player: returns text
