# ruysong/codetree architecture

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

- Interactive diagram: https://gitdiagram.com/ruysong/codetree
- Repository: https://github.com/ruysong/codetree

## Overview

This repository is a collection of independent C++ programming exercises, not a single application. For each exercise, a user supplies input on standard input, the program computes a result, and it writes that result to standard output. The sampled programs cover grid and motion simulations, collision and explosion rules, combinatorial search, and interval or geometric optimization. The graph shows representative standalone programs; no shared runtime or calls between exercises are evidenced. Connections are limited to input/output behavior visible in the sampled source.

Main entry points: [`trail4/1차원 바람/The-1D-wind-blows.cpp`](https://github.com/ruysong/codetree/blob/main/trail4/1%EC%B0%A8%EC%9B%90%20%EB%B0%94%EB%9E%8C/The-1D-wind-blows.cpp) (1D wind), [`trail4/2차원 폭발 게임/The-2D-bomb-game.cpp`](https://github.com/ruysong/codetree/blob/main/trail4/2%EC%B0%A8%EC%9B%90%20%ED%8F%AD%EB%B0%9C%20%EA%B2%8C%EC%9E%84/The-2D-bomb-game.cpp) (2D bomb game), [`trail4/쌓인 숫자의 순차적 이동/sequential-movement-of-stacked-numbers.cpp`](https://github.com/ruysong/codetree/blob/main/trail4/%EC%8C%93%EC%9D%B8%20%EC%88%AB%EC%9E%90%EC%9D%98%20%EC%88%9C%EC%B0%A8%EC%A0%81%20%EC%9D%B4%EB%8F%99/sequential-movement-of-stacked-numbers.cpp) (Stacked number moves), [`trail4/구슬의 이동/marble-movement.cpp`](https://github.com/ruysong/codetree/blob/main/trail4/%EA%B5%AC%EC%8A%AC%EC%9D%98%20%EC%9D%B4%EB%8F%99/marble-movement.cpp) (Marble movement)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulations["Grid simulations"]
  node_wind1d["1D wind"]
  node_bomb2d["2D bomb game"]
  node_stacked["Stacked number moves"]
end

subgraph group_motion["Motion and collisions"]
  node_marble_move["Marble movement"]
  node_collision["Collision experiment"]
  node_merge["Merge marbles<br/>[merge-marbles.cpp]"]
  node_simul_move["Simultaneous movement"]
  node_maze["Wall-following maze"]
end

subgraph group_search["Combinatorial search"]
  node_bomb_search["Explosion type search"]
  node_thieves["Two-thief selection<br/>[two-thieves.cpp]"]
  node_points["Choose points"]
end

subgraph group_optimization["Optimization exercises"]
  node_rectangles["Disjoint rectangles"]
  node_service_hours["Service hours"]
  node_laser["Laser and mirrors"]
  node_binary["Awkward digits"]
end

node_user(("Exercise user"))

node_user -->|"provides input"| node_wind1d
node_wind1d -->|"prints grid"| node_user
node_user -->|"provides input"| node_bomb2d
node_bomb2d -->|"prints count"| node_user
node_user -->|"provides input"| node_stacked
node_stacked -->|"prints grid"| node_user
node_user -->|"provides input"| node_marble_move
node_marble_move -->|"prints count"| node_user
node_user -->|"provides input"| node_collision
node_collision -->|"prints result"| node_user
node_user -->|"provides input"| node_merge
node_merge -->|"prints totals"| node_user
node_user -->|"provides input"| node_simul_move
node_simul_move -->|"prints count"| node_user
node_user -->|"provides input"| node_maze
node_maze -->|"prints steps"| node_user
node_user -->|"provides input"| node_bomb_search
node_bomb_search -->|"prints maximum"| node_user
node_user -->|"provides input"| node_thieves
node_thieves -->|"prints value"| node_user
node_user -->|"provides input"| node_rectangles
node_rectangles -->|"prints maximum"| node_user
node_user -->|"provides input"| node_service_hours
node_service_hours -->|"prints duration"| node_user

click node_wind1d "https://github.com/ruysong/codetree/blob/main/trail4/1%EC%B0%A8%EC%9B%90%20%EB%B0%94%EB%9E%8C/The-1D-wind-blows.cpp"
click node_bomb2d "https://github.com/ruysong/codetree/blob/main/trail4/2%EC%B0%A8%EC%9B%90%20%ED%8F%AD%EB%B0%9C%20%EA%B2%8C%EC%9E%84/The-2D-bomb-game.cpp"
click node_stacked "https://github.com/ruysong/codetree/blob/main/trail4/%EC%8C%93%EC%9D%B8%20%EC%88%AB%EC%9E%90%EC%9D%98%20%EC%88%9C%EC%B0%A8%EC%A0%81%20%EC%9D%B4%EB%8F%99/sequential-movement-of-stacked-numbers.cpp"
click node_marble_move "https://github.com/ruysong/codetree/blob/main/trail4/%EA%B5%AC%EC%8A%AC%EC%9D%98%20%EC%9D%B4%EB%8F%99/marble-movement.cpp"
click node_collision "https://github.com/ruysong/codetree/blob/main/trail4/%EB%B2%BD%EC%9D%B4%20%EC%97%86%EB%8A%94%20%EC%B6%A9%EB%8F%8C%20%EC%8B%A4%ED%97%98/collision-experiment-without-wall.cpp"
click node_merge "https://github.com/ruysong/codetree/blob/main/trail4/%ED%95%A9%EC%B3%90%EC%A7%80%EB%8A%94%20%EA%B5%AC%EC%8A%AC%EB%93%A4/merge-marbles.cpp"
click node_simul_move "https://github.com/ruysong/codetree/blob/main/trail4/%EC%88%AB%EC%9E%90%EA%B0%80%20%EA%B0%80%EC%9E%A5%20%ED%81%B0%20%EC%9D%B8%EC%A0%91%ED%95%9C%20%EA%B3%B3%EC%9C%BC%EB%A1%9C%20%EB%8F%99%EC%8B%9C%EC%97%90%20%EC%9D%B4%EB%8F%99/move-to-max-adjacent-cell-simultaneously.cpp"
click node_maze "https://github.com/ruysong/codetree/blob/main/trail4/%EB%B2%BD%20%EC%A7%9A%EA%B3%A0%20%EB%AF%B8%EB%A1%9C%20%ED%83%88%EC%B6%9C%ED%95%98%EA%B8%B0/escape-maze-with-wall-following.cpp"
click node_bomb_search "https://github.com/ruysong/codetree/blob/main/trail4/%EA%B0%95%EB%A0%A5%ED%95%9C%20%ED%8F%AD%EB%B0%9C/strong-explosion.cpp"
click node_thieves "https://github.com/ruysong/codetree/blob/main/trail4/2%EB%AA%85%EC%9D%98%20%EB%8F%84%EB%91%91/two-thieves.cpp"
click node_points "https://github.com/ruysong/codetree/blob/main/trail4/N%EA%B0%9C%EC%9D%98%20%EC%A0%90%20%EC%A4%91%20M%EA%B0%9C%20%EA%B3%A0%EB%A5%B4%EA%B8%B0/choose-m-out-of-n-points.cpp"
click node_rectangles "https://github.com/ruysong/codetree/blob/main/trail4/%EA%B2%B9%EC%B3%90%EC%A7%80%EC%A7%80%20%EC%95%8A%EB%8A%94%20%EB%91%90%20%EC%A7%81%EC%82%AC%EA%B0%81%ED%98%95/non-overlapping-two-rectangles.cpp"
click node_service_hours "https://github.com/ruysong/codetree/blob/main/trail2/%EC%9A%B4%ED%96%89%20%EB%90%98%EA%B3%A0%20%EC%9E%88%EB%8A%94%20%EC%8B%9C%EA%B0%84/hours-in-service.cpp"
click node_laser "https://github.com/ruysong/codetree/blob/main/trail2/%EA%B1%B0%EC%9A%B8%EC%97%90%20%EB%A0%88%EC%9D%B4%EC%A0%80%20%EC%8F%98%EA%B8%B0%202/shoot-a-laser-in-the-mirror-2.cpp"
click node_binary "https://github.com/ruysong/codetree/blob/main/trail2/%EC%9D%B4%EC%83%81%ED%95%9C%20%EC%A7%84%EC%88%98%202/awkward-digits-2.cpp"

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_wind1d,node_bomb2d,node_stacked,node_user toneBlue
class node_marble_move,node_collision,node_merge,node_simul_move,node_maze toneAmber
class node_bomb_search,node_thieves,node_points toneMint
class node_rectangles,node_service_hours,node_laser,node_binary toneRose
```

## Components

### Grid simulations

- [1D wind](https://github.com/ruysong/codetree/blob/main/trail4/1%EC%B0%A8%EC%9B%90%20%EB%B0%94%EB%9E%8C/The-1D-wind-blows.cpp): `trail4/1차원 바람/The-1D-wind-blows.cpp`
- [2D bomb game](https://github.com/ruysong/codetree/blob/main/trail4/2%EC%B0%A8%EC%9B%90%20%ED%8F%AD%EB%B0%9C%20%EA%B2%8C%EC%9E%84/The-2D-bomb-game.cpp): `trail4/2차원 폭발 게임/The-2D-bomb-game.cpp`
- [Stacked number moves](https://github.com/ruysong/codetree/blob/main/trail4/%EC%8C%93%EC%9D%B8%20%EC%88%AB%EC%9E%90%EC%9D%98%20%EC%88%9C%EC%B0%A8%EC%A0%81%20%EC%9D%B4%EB%8F%99/sequential-movement-of-stacked-numbers.cpp): `trail4/쌓인 숫자의 순차적 이동/sequential-movement-of-stacked-numbers.cpp`

### Motion and collisions

- [Marble movement](https://github.com/ruysong/codetree/blob/main/trail4/%EA%B5%AC%EC%8A%AC%EC%9D%98%20%EC%9D%B4%EB%8F%99/marble-movement.cpp): `trail4/구슬의 이동/marble-movement.cpp`
- [Collision experiment](https://github.com/ruysong/codetree/blob/main/trail4/%EB%B2%BD%EC%9D%B4%20%EC%97%86%EB%8A%94%20%EC%B6%A9%EB%8F%8C%20%EC%8B%A4%ED%97%98/collision-experiment-without-wall.cpp): `trail4/벽이 없는 충돌 실험/collision-experiment-without-wall.cpp`
- [Merge marbles](https://github.com/ruysong/codetree/blob/main/trail4/%ED%95%A9%EC%B3%90%EC%A7%80%EB%8A%94%20%EA%B5%AC%EC%8A%AC%EB%93%A4/merge-marbles.cpp): `trail4/합쳐지는 구슬들/merge-marbles.cpp`
- [Simultaneous movement](https://github.com/ruysong/codetree/blob/main/trail4/%EC%88%AB%EC%9E%90%EA%B0%80%20%EA%B0%80%EC%9E%A5%20%ED%81%B0%20%EC%9D%B8%EC%A0%91%ED%95%9C%20%EA%B3%B3%EC%9C%BC%EB%A1%9C%20%EB%8F%99%EC%8B%9C%EC%97%90%20%EC%9D%B4%EB%8F%99/move-to-max-adjacent-cell-simultaneously.cpp): `trail4/숫자가 가장 큰 인접한 곳으로 동시에 이동/move-to-max-adjacent-cell-simultaneously.cpp`
- [Wall-following maze](https://github.com/ruysong/codetree/blob/main/trail4/%EB%B2%BD%20%EC%A7%9A%EA%B3%A0%20%EB%AF%B8%EB%A1%9C%20%ED%83%88%EC%B6%9C%ED%95%98%EA%B8%B0/escape-maze-with-wall-following.cpp): `trail4/벽 짚고 미로 탈출하기/escape-maze-with-wall-following.cpp`

### Combinatorial search

- [Explosion type search](https://github.com/ruysong/codetree/blob/main/trail4/%EA%B0%95%EB%A0%A5%ED%95%9C%20%ED%8F%AD%EB%B0%9C/strong-explosion.cpp): `trail4/강력한 폭발/strong-explosion.cpp`
- [Two-thief selection](https://github.com/ruysong/codetree/blob/main/trail4/2%EB%AA%85%EC%9D%98%20%EB%8F%84%EB%91%91/two-thieves.cpp): `trail4/2명의 도둑/two-thieves.cpp`
- [Choose points](https://github.com/ruysong/codetree/blob/main/trail4/N%EA%B0%9C%EC%9D%98%20%EC%A0%90%20%EC%A4%91%20M%EA%B0%9C%20%EA%B3%A0%EB%A5%B4%EA%B8%B0/choose-m-out-of-n-points.cpp): `trail4/N개의 점 중 M개 고르기/choose-m-out-of-n-points.cpp`

### Optimization exercises

- [Disjoint rectangles](https://github.com/ruysong/codetree/blob/main/trail4/%EA%B2%B9%EC%B3%90%EC%A7%80%EC%A7%80%20%EC%95%8A%EB%8A%94%20%EB%91%90%20%EC%A7%81%EC%82%AC%EA%B0%81%ED%98%95/non-overlapping-two-rectangles.cpp): `trail4/겹쳐지지 않는 두 직사각형/non-overlapping-two-rectangles.cpp`
- [Service hours](https://github.com/ruysong/codetree/blob/main/trail2/%EC%9A%B4%ED%96%89%20%EB%90%98%EA%B3%A0%20%EC%9E%88%EB%8A%94%20%EC%8B%9C%EA%B0%84/hours-in-service.cpp): `trail2/운행 되고 있는 시간/hours-in-service.cpp`
- [Laser and mirrors](https://github.com/ruysong/codetree/blob/main/trail2/%EA%B1%B0%EC%9A%B8%EC%97%90%20%EB%A0%88%EC%9D%B4%EC%A0%80%20%EC%8F%98%EA%B8%B0%202/shoot-a-laser-in-the-mirror-2.cpp): `trail2/거울에 레이저 쏘기 2/shoot-a-laser-in-the-mirror-2.cpp`
- [Awkward digits](https://github.com/ruysong/codetree/blob/main/trail2/%EC%9D%B4%EC%83%81%ED%95%9C%20%EC%A7%84%EC%88%98%202/awkward-digits-2.cpp): `trail2/이상한 진수 2/awkward-digits-2.cpp`

### Other components

- **Exercise user**

## Connections

- Exercise user → 1D wind: provides input (evidence: `trail4/1차원 바람/The-1D-wind-blows.cpp`)
- 1D wind → Exercise user: prints grid (evidence: `trail4/1차원 바람/The-1D-wind-blows.cpp`)
- Exercise user → 2D bomb game: provides input (evidence: `trail4/2차원 폭발 게임/The-2D-bomb-game.cpp`)
- 2D bomb game → Exercise user: prints count (evidence: `trail4/2차원 폭발 게임/The-2D-bomb-game.cpp`)
- Exercise user → Stacked number moves: provides input (evidence: `trail4/쌓인 숫자의 순차적 이동/sequential-movement-of-stacked-numbers.cpp`)
- Stacked number moves → Exercise user: prints grid (evidence: `trail4/쌓인 숫자의 순차적 이동/sequential-movement-of-stacked-numbers.cpp`)
- Exercise user → Marble movement: provides input (evidence: `trail4/구슬의 이동/marble-movement.cpp`)
- Marble movement → Exercise user: prints count (evidence: `trail4/구슬의 이동/marble-movement.cpp`)
- Exercise user → Collision experiment: provides input (evidence: `trail4/벽이 없는 충돌 실험/collision-experiment-without-wall.cpp`)
- Collision experiment → Exercise user: prints result (evidence: `trail4/벽이 없는 충돌 실험/collision-experiment-without-wall.cpp`)
- Exercise user → Merge marbles: provides input (evidence: `trail4/합쳐지는 구슬들/merge-marbles.cpp`)
- Merge marbles → Exercise user: prints totals (evidence: `trail4/합쳐지는 구슬들/merge-marbles.cpp`)
- Exercise user → Simultaneous movement: provides input (evidence: `trail4/숫자가 가장 큰 인접한 곳으로 동시에 이동/move-to-max-adjacent-cell-simultaneously.cpp`)
- Simultaneous movement → Exercise user: prints count (evidence: `trail4/숫자가 가장 큰 인접한 곳으로 동시에 이동/move-to-max-adjacent-cell-simultaneously.cpp`)
- Exercise user → Wall-following maze: provides input (evidence: `trail4/벽 짚고 미로 탈출하기/escape-maze-with-wall-following.cpp`)
- Wall-following maze → Exercise user: prints steps (evidence: `trail4/벽 짚고 미로 탈출하기/escape-maze-with-wall-following.cpp`)
- Exercise user → Explosion type search: provides input (evidence: `trail4/강력한 폭발/strong-explosion.cpp`)
- Explosion type search → Exercise user: prints maximum (evidence: `trail4/강력한 폭발/strong-explosion.cpp`)
- Exercise user → Two-thief selection: provides input (evidence: `trail4/2명의 도둑/two-thieves.cpp`)
- Two-thief selection → Exercise user: prints value (evidence: `trail4/2명의 도둑/two-thieves.cpp`)
- Exercise user → Disjoint rectangles: provides input (evidence: `trail4/겹쳐지지 않는 두 직사각형/non-overlapping-two-rectangles.cpp`)
- Disjoint rectangles → Exercise user: prints maximum (evidence: `trail4/겹쳐지지 않는 두 직사각형/non-overlapping-two-rectangles.cpp`)
- Exercise user → Service hours: provides input (evidence: `trail2/운행 되고 있는 시간/hours-in-service.cpp`)
- Service hours → Exercise user: prints duration (evidence: `trail2/운행 되고 있는 시간/hours-in-service.cpp`)
