Forked from semiexp/logic-pad-solver. Huge thanks to semiexp for the powerful cspuz solver and the original Logic Pad solver implementation.
A solver for Logic Pad based on cspuz.
- Global rules
- Forbidden patterns (
Don't make this pattern) - Connectivity (
Connect all light / dark cells) - Shape constraints (
All light / dark areas have the same / different shape and size) - Region size (
All light / dark regions have area N) - Total count (
There are N light / dark cells in total) - Off by X (
All numbers are off by X) - Underclued (
Underclued grid: mark only what is definitely true) - Symbols per region (
At most / at least / exactly N symbols per light / dark area)
- Forbidden patterns (
- Cell rules
- Fixed tiles
- Merged tiles
- Area Number
- Letter
- Viewpoint
- Dart
- Lotus (with dual-color support)
- Galaxy (with dual-color support)
- Minesweeper
This repo has two parts:
packages/@logic-pad/cspuz-solver— the solver, published to npm as@logic-pad/cspuz-solver.- the web app at the repo root (a Vite + React front-end that consumes the package above via a
file:dependency).
Prerequisites:
-
Install Rust with the
wasm32-unknown-emscriptentarget:rustup target add wasm32-unknown-emscripten -
Install emscripten (emsdk). Activate it so that
emccis on yourPATHbefore building. -
Clone
cspuz_corenext to this repository (as a sibling directory, not inside it). The Rust solver refers to it through the relative path../../../../cspuz_core, so the layout must be:<some-dir>/ ├── cspuz_core/ # git clone --recursive https://github.com/semiexp/cspuz_core.git └── logic-pad-solver/ # this repositoryUse
--recursivebecausecspuz_corehas its own submodules.
Note:
@logic-pad/coreused to be vendored as a git submodule undersrc/logic-pad(which required a manual patch tostreamCompressor.ts). It is now a plain npm dependency, so there is nothing to clone or patch —npm installhandles it.
The
build-rustscript uses POSIX commands (cd,cp,&&); on Windows run it from a POSIX shell such as WSL or Git Bash.
Build the solver package:
cd packages/@logic-pad/cspuz-solver
npm install
npm run build-rust # compiles the Rust solver to WebAssembly -> src/core/solver.js
npm pack # produces @logic-pad/cspuz-solver-<version>.tgz
To publish, either run npm publish --provenance --access public from that directory, or trigger the Publish @logic-pad/cspuz-solver workflow (.github/workflows/publish.yml) on GitHub, which sets up the toolchain and publishes for you.
From the repo root:
npm install
# the app links @logic-pad/cspuz-solver via `file:`, so build the solver first:
(cd packages/@logic-pad/cspuz-solver && npm run build-rust)
npm run dev # start the dev server
npm run build # create a release build (dist/)
cd packages/@logic-pad/cspuz-solver
npm test