#include "nonogram.h" #include int main() { // Load a nonogram from file auto nonogram = NonogramLoader::fromFile("/home/connor/repos/nd-wfc/demos/nonogram/data/db/webpbn/1.non"); if (!nonogram) { std::cout << "Failed to load nonogram!" << std::endl; return 1; } std::cout << "Loaded nonogram: " << nonogram->getWidth() << "x" << nonogram->getHeight() << std::endl; // Display row hints std::cout << "\nRow hints:" << std::endl; for (size_t i = 0; i < nonogram->getRowCount(); ++i) { const auto& hints = nonogram->getRowHints(i); std::cout << "Row " << i << ":"; for (uint8_t hint : hints) { std::cout << " " << static_cast(hint); } std::cout << std::endl; } // Display column hints std::cout << "\nColumn hints:" << std::endl; for (size_t i = 0; i < nonogram->getColumnCount(); ++i) { const auto& hints = nonogram->getColumnHints(i); std::cout << "Col " << i << ":"; for (uint8_t hint : hints) { std::cout << " " << static_cast(hint); } std::cout << std::endl; } // Display solution if available if (nonogram->hasSolution()) { std::cout << "\nSolution:" << std::endl; for (size_t row = 0; row < nonogram->getHeight(); ++row) { for (size_t col = 0; col < nonogram->getWidth(); ++col) { std::cout << (nonogram->getSolutionCell(row, col) ? "1" : "0"); } std::cout << std::endl; } } // Load all nonograms from a directory std::cout << "\nLoading all nonograms from directory..." << std::endl; auto puzzles = NonogramLoader::fromDirectory("/home/connor/repos/nd-wfc/demos/nonogram/data/db/webpbn"); std::cout << "Loaded " << puzzles.size() << " puzzles:" << std::endl; for (size_t i = 0; i < puzzles.size(); ++i) { std::cout << " Puzzle " << i << ": " << puzzles[i].getWidth() << "x" << puzzles[i].getHeight(); if (puzzles[i].hasSolution()) { std::cout << " (with solution)"; } std::cout << std::endl; } return 0; }