# dawidrylko/domino-tiling architecture

> Architecture diagram of the GitHub repository dawidrylko/domino-tiling, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dawidrylko/domino-tiling
- Repository: https://github.com/dawidrylko/domino-tiling

## Overview

##### Main Components
- Solver Modules:
- dominoTilingSolver.js: Implements the standard domino tiling solution using a recursive function (searchTileArrangements) with dynamic programming and bitmask optimization.
- dominoTilingSolver-BigInt.js: Provides the same functionality as the standard solver but with support for very large numbers using BigInt.
- Benchmark Scripts:
- benchmarkRunner.js: Drives the benchmark tests for both solver implementations using different grid sizes (as seen in the benchmark directory with test files like dominoTilingSolver.js_10x10.txt, etc.).
- Benchmark test files within the benchmark directory.
- Testing Infrastructure:
- testRunner.js: Runs the test cases contained in the test-data folder.
- test-data: Contains JSON formatted test cases and indexing files.
- Helper/Utilities:
- helpers folder (commandLineArgsParser.js, scriptExecutor.js, verifiers.js): Provides common reusable methods for parsing command line arguments, executing scripts, and verifying outcomes.
- CI/CD Integration:
- .github/workflows/ci.yml: A GitHub Actions configuration that automates testing and builds.

##### Relationships/Interactions
- The core solver functions are called by both the benchmark and test runner scripts, which in turn leverage the helper modules to parse command-line arguments and manage script execution.
- The solver modules (both BigInt and standard) feed results to the test suite to be validated (using helpers/verifiers.js), and performance metrics are output through the benchmarkRunner.
- Configuration files like .nvmrc, package.json, and package-lock.json dictate the runtime environment and dependencies, while the CI workflow (.github/workflows) uses these files to set up automated testing.
- The README provides usage examples and points to the external blog post for greater context, which might be referenced as part of the documentation layer in your architecture.

##### Architectural Patterns/Design Principles
- Modular Design: The project is divided into well-defined modules (solver functions, CLI utilities, testing) that clearly separate the different areas of functionality.
- Separation of Concerns: One set of files deals directly with solving the domino tiling problem, whereas other files focus on benchmarking, testing, and supporting utilities.
- Reusability and Maintainability: Helper modules abstract common tasks which can be easily reused by both test and benchmark runners, ensuring consistency across the project.

##### Technologies and Frameworks
- JavaScript (Node.js): The runtime environment, with a specific version mandated by the .nvmrc file.
- GitHub Actions: For continuous integration testing defined in .github/workflows/ci.yml.
- BigInt: Native JavaScript (BigInt) support for handling very large numbers in one of the solver implementations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Logic Layer"
        SOLVER_STD["Solver: Standard Domino Tiling \n(Recursive, DP, Bitmask)"]:::core
        SOLVER_BIG["Solver: BigInt Domino Tiling \n(Recursive, DP, Bitmask with BigInt)"]:::core
    end

    subgraph "Interface Layer"
        BENCH_RUNNER["Benchmark Runner"]:::interface
        TEST_RUNNER["Test Runner"]:::interface
    end

    subgraph "Utility Layer"
        UTIL_HELPERS["Helper Modules \n(CommandLineArgs, ScriptExecutor, Verifiers)"]:::utility
    end

    subgraph "Integration/Testing Layer"
        BENCH_FILES["Benchmark Test Files"]:::integration
        TEST_DATA["Test Data \n(JSON test cases & index)"]:::integration
    end

    subgraph "Deployment/Configuration"
        CI_CD["CI/CD Integration \n(GitHub Actions)"]:::config
        NODE_JS["Node.js Configuration"]:::config
    end

    %% Connections from Interface Layer to Core Logic Layer
    BENCH_RUNNER -->|"calls"| SOLVER_STD
    BENCH_RUNNER -->|"calls"| SOLVER_BIG
    TEST_RUNNER  -->|"calls"| SOLVER_STD
    TEST_RUNNER  -->|"calls"| SOLVER_BIG

    %% Connections to Utility Layer
    BENCH_RUNNER -->|"uses"| UTIL_HELPERS
    TEST_RUNNER  -->|"uses"| UTIL_HELPERS

    %% Connections to Integration/Testing Layer
    BENCH_RUNNER -->|"executes with"| BENCH_FILES
    TEST_RUNNER  -->|"executes with"| TEST_DATA

    %% CI/CD triggers the runners
    CI_CD -->|"triggers"| BENCH_RUNNER
    CI_CD -->|"triggers"| TEST_RUNNER

    %% Node configuration influences the system
    NODE_JS -->|"configures"| BENCH_RUNNER
    NODE_JS -->|"configures"| TEST_RUNNER

    %% Styles
    classDef core fill:#ffdddd,stroke:#cc0000,stroke-width:2px;
    classDef interface fill:#ddffdd,stroke:#339900,stroke-width:2px;
    classDef utility fill:#ddeeff,stroke:#003399,stroke-width:2px;
    classDef integration fill:#fff0b3,stroke:#cc7a00,stroke-width:2px;
    classDef config fill:#e6e6fa,stroke:#663399,stroke-width:2px;

    %% Click Events
    click SOLVER_STD "https://github.com/dawidrylko/domino-tiling/blob/master/dominoTilingSolver.js"
    click SOLVER_BIG "https://github.com/dawidrylko/domino-tiling/blob/master/dominoTilingSolver-BigInt.js"
    click BENCH_RUNNER "https://github.com/dawidrylko/domino-tiling/blob/master/benchmarkRunner.js"
    click BENCH_FILES "https://github.com/dawidrylko/domino-tiling/tree/master/benchmark/"
    click TEST_RUNNER "https://github.com/dawidrylko/domino-tiling/blob/master/testRunner.js"
    click TEST_DATA "https://github.com/dawidrylko/domino-tiling/tree/master/test-data/"
    click UTIL_HELPERS "https://github.com/dawidrylko/domino-tiling/tree/master/helpers/"
    click CI_CD "https://github.com/dawidrylko/domino-tiling/blob/master/.github/workflows/ci.yml"
    click NODE_JS "https://github.com/dawidrylko/domino-tiling/blob/master/.nvmrc"
```
