Skip to content

alanlau28/Parallel-Skyscrapers-Solver

Repository files navigation

ASSIGNMENT 1

Requirements

  1. CMake >= 3.10
  2. C++ Standard: 17 (important as std::filesystem is used)

Usage

The input and output puzzle directories and number of threads (if parallel approach is chosen) are given as command-line arguments. Input puzzles are given as .txt files, in which empty cells are indicated with '.', and empty hints are shown with '-'. See the input puzzle format in, puzzle4x4, puzzle5x5 and puzzle6x6 directories.

Compilation

Use VSCode CMake extension to build, or use the following commands:

Inside the Skyscrapers directory:

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .

Move back to Skyscrapers:

cd .. 

Command

./build/Skyscrapers <PUZZLES_PATH> <OUTPUT_PATH> <MODE> <#THREADS>
  1. PUZZLES_PATH: Relative/absolute path of input puzzle directory
  2. OUTPUT_PATH: Relative/absolute output path
  3. MODE: 1: Sequential, 2: BruteForceParallel, 3: EfficientParallel
  4. #THREADS: Number of threads. Only for Mode 2 or 3, omitted for Mode 1.

Example (Mode 2):

./build/Skyscrapers ./puzzle5x5 ./solutions5x5 2 10 

Example (Mode 1):

./build/Skyscrapers ./puzzle5x5 ./solutions5x5 1 

Results

Solved puzzles are stored in the output directory with the suffix '_solutions.txt' with the following information:

  1. Solved puzzle in the same format as the input
  2. If the puzzle is solved or not (0: No solution, 1: Solved)
  3. Solution time (Given with the line "Time taken: ")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors