Compare commits

..

3 Commits

Author SHA1 Message Date
3c6d69c343 Simplified selectColumnSizeHeuristic 2021-02-25 11:16:16 -07:00
1ff71d099e Update Dockerfile 2021-02-25 11:16:16 -07:00
ae9016fbf6 Update all imports to .js for esm support, use threads.js
threads.js has better support for modules - no need to give a
project-relative path to the worker file, which complicated the build.

Add rudimentary thread pooling w/ execution timeout.
2021-02-25 11:16:16 -07:00

View File

@ -5,9 +5,12 @@ const maths = {};
expose({ expose({
generate(regionWidth, regionHeight, clues) { generate(regionWidth, regionHeight, clues) {
const key = `${regionWidth}:${regionHeight}`;
const math = const math =
maths[key] ?? (maths[key] = new SudokuMath(regionWidth, regionHeight)); maths[`${regionWidth}:${regionHeight}`] ||
(maths[`${regionWidth}:${regionHeight}`] = new SudokuMath(
regionWidth,
regionHeight
));
return math.generate(clues); return math.generate(clues);
}, },
}); });