# yeahhe365/rubik-cube-simulator architecture

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

- Interactive diagram: https://gitdiagram.com/yeahhe365/rubik-cube-simulator
- Repository: https://github.com/yeahhe365/rubik-cube-simulator

## Overview

This is a native Android Rubik’s Cube simulator. The documented user-facing capability is interacting with a simulated cube; the tree also shows a local solve-record persistence layer. Source excerpts are limited to build configuration, so runtime connections—especially between UI, cube state, and persistence—are not verified and are shown only as dashed links.

Main entry points: [`app/src/main/java/com/example/database/SolveDao.kt`](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/database/SolveDao.kt) (Solve DAO), [`app/src/main/java/com/example/MainActivity.kt`](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/MainActivity.kt) (Main activity), [`app/src/main/java/com/example/ui/RubikCubeSimulator.kt`](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/ui/RubikCubeSimulator.kt) (Cube simulator UI), [`app/src/main/java/com/example/ui/RubikViewModel.kt`](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/ui/RubikViewModel.kt) (Cube view model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Android interface"]
  node_activity["Main activity<br/>[MainActivity.kt]"]
  node_simulator["Cube simulator UI"]
  node_viewmodel["Cube view model<br/>[RubikViewModel.kt]"]
end

subgraph group_cube["Cube simulation"]
  node_cube["Cube state<br/>[RubikCube.kt]"]
  node_face["Cube faces<br/>[Face.kt]"]
  node_color["Cube colors<br/>[CubeColor.kt]"]
end

subgraph group_storage["Solve storage"]
  node_repository["Solve repository<br/>[SolveRepository.kt]"]
  node_dao["Solve DAO<br/>[SolveDao.kt]"]
  node_record["Solve record<br/>[SolveRecord.kt]"]
  node_database[("App database<br/>[AppDatabase.kt]")]
end

node_user(("User"))

node_user -.->|"opens app"| node_activity
node_activity -.->|"shows UI"| node_simulator
node_simulator -.->|"handles interaction"| node_viewmodel
node_viewmodel -.->|"updates state"| node_cube
node_repository -.->|"uses"| node_dao
node_dao -.->|"accesses"| node_database
node_dao -.->|"maps records"| node_record

click node_activity "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/MainActivity.kt"
click node_simulator "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/ui/RubikCubeSimulator.kt"
click node_viewmodel "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/ui/RubikViewModel.kt"
click node_cube "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/model/RubikCube.kt"
click node_face "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/model/Face.kt"
click node_color "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/model/CubeColor.kt"
click node_repository "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/database/SolveRepository.kt"
click node_dao "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/database/SolveDao.kt"
click node_record "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/database/SolveRecord.kt"
click node_database "https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/database/AppDatabase.kt"

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_activity,node_simulator,node_viewmodel,node_user toneBlue
class node_cube,node_face,node_color toneAmber
class node_repository,node_dao,node_record,node_database toneMint
```

## Components

### Android interface

- [Main activity](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/MainActivity.kt): `app/src/main/java/com/example/MainActivity.kt`
- [Cube simulator UI](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/ui/RubikCubeSimulator.kt): `app/src/main/java/com/example/ui/RubikCubeSimulator.kt`
- [Cube view model](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/ui/RubikViewModel.kt): `app/src/main/java/com/example/ui/RubikViewModel.kt`

### Cube simulation

- [Cube state](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/model/RubikCube.kt): `app/src/main/java/com/example/model/RubikCube.kt`
- [Cube faces](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/model/Face.kt): `app/src/main/java/com/example/model/Face.kt`
- [Cube colors](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/model/CubeColor.kt): `app/src/main/java/com/example/model/CubeColor.kt`

### Solve storage

- [Solve repository](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/database/SolveRepository.kt): `app/src/main/java/com/example/database/SolveRepository.kt`
- [Solve DAO](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/database/SolveDao.kt): `app/src/main/java/com/example/database/SolveDao.kt`
- [Solve record](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/database/SolveRecord.kt): `app/src/main/java/com/example/database/SolveRecord.kt`
- [App database](https://github.com/yeahhe365/rubik-cube-simulator/blob/main/app/src/main/java/com/example/database/AppDatabase.kt): `app/src/main/java/com/example/database/AppDatabase.kt`

### Other components

- **User**

## Connections

- User → Main activity: opens app
- Main activity → Cube simulator UI: shows UI
- Cube simulator UI → Cube view model: handles interaction
- Cube view model → Cube state: updates state
- Solve repository → Solve DAO: uses
- Solve DAO → App database: accesses
- Solve DAO → Solve record: maps records
