How dawidrylko/domino-tiling works
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.