puzlink
v0.2.0
Published
Tool to find patterns among sets of words
Readme
puzlink.js
Tool to find patterns among sets of words. Use it online at cjquines.com/puzlink.
Inspired by cosmologicon's puzlink, rdeits's Collective.jl, and obijywk's fork of the latter.
Usage
Install with npm install puzlink. This is an ESM only library.
import { Puzlink } from "puzlink";
const puzlink = await Puzlink.download();
puzlink.link(`
BATED, TANK, BUSINESS, ETC, OVER, ELVIS, CAR, COW, MARS, PARIS, AIRLINES
`);
// {
// name: "10/11 can insert h",
// score: 30.8,
// description: [
// "bated insert h = bathed",
// "tank insert h = thank",
// "etc insert h = etch",
// "over insert h = hover",
// "elvis insert h = elvish",
// "car insert h = char",
// "cow insert h = chow",
// "mars insert h = marsh",
// "paris insert h = parish, pharis",
// "airlines insert h = hairlines"
// ],
// },
// ...Why?
puzlink used to be online on puz.link, but the website has been down for maintenance for a while now. While I've used the library locally, nothing can beat the convenience of a web app. I'm a believer in client-side solving tools, so I wanted to make it run client-side too; that's partly why I wrote cromulence a year ago.
Collective.jl is a huge design influence. I liked the idea of applying the binomial distribution to boolean word properties, which I used for computing many linker probabilities. A lot of the test cases in scripts/evals are from Collective.jl too.
Development
Node 22 required. Clone the repo and run npm install. Some ways to contribute:
Add an eval:
$ npm run test:evals -- --add name_of_puzzle # ^^ note the dashes $ npm run test:evals -- --watchThen, edit
scripts/evals/name_of_puzzle.ts. See the other examples in that folder for details. Thetest:evalsscript has several other flags; run it with--helpfor more info.Add a category. Edit
src/data/categories/txt/nameOfCategory.txt. Thennpm run build:categories, and editsrc/data/categories.ts.Adding tests would be nice too. You can add a unit test by running
npm run test:watch, and editingsrc/features/substring.test.ts. You can also add an eval, as above.Add a feature. See existing feature implementations in
src/features. Runnpm run build:knownLogProbsbefore running evals.Fiddle with the app. To set up the app, run
npm run build:tscfrom the root, thencd appandnpm install. From there,npm run devto start the dev server.You will need to rerun
npm run build:tscevery time you make a change not in the app.
