mirror of
https://github.com/Z3Prover/z3
synced 2025-10-01 13:39:28 +00:00
Update emscripten (#7473)
* fixes for newer emscripten thread handling behavior * fix return type for async wrapper functions * update prettier * update typescript and fix errors * update emscripten version in CI * update js readme about tests
This commit is contained in:
parent
4fbf54afd0
commit
e5f8327483
17 changed files with 275 additions and 108 deletions
|
@ -1,4 +1,4 @@
|
|||
import { init } from '../../build/node';
|
||||
import { init } from '../../build/node.js';
|
||||
|
||||
import type { Solver, Arith } from '../../build/node';
|
||||
|
||||
|
@ -157,7 +157,9 @@ function parseSudoku(str: string) {
|
|||
|
||||
async function solve(str: string) {
|
||||
let solver = new Z3.Solver();
|
||||
let cells = Array.from({ length: 9 }, (_, col) => Array.from({ length: 9 }, (_, row) => Z3.Int.const(`c_${row}_${col}`)));
|
||||
let cells = Array.from({ length: 9 }, (_, col) =>
|
||||
Array.from({ length: 9 }, (_, row) => Z3.Int.const(`c_${row}_${col}`)),
|
||||
);
|
||||
for (let { row, col, value } of parseSudoku(str)) {
|
||||
solver.add(cells[row][col].eq(value));
|
||||
}
|
||||
|
@ -198,8 +200,6 @@ function parseSudoku(str: string) {
|
|||
.........
|
||||
.........
|
||||
`);
|
||||
|
||||
em.PThread.terminateAllThreads();
|
||||
})().catch(e => {
|
||||
console.error('error', e);
|
||||
process.exit(1);
|
||||
|
|
|
@ -25,12 +25,11 @@ import assert from 'assert';
|
|||
const model = solver.model();
|
||||
let modelStr = model.sexpr();
|
||||
modelStr = modelStr.replace(/\n/g, ' ');
|
||||
console.log("Model: ", modelStr);
|
||||
console.log('Model: ', modelStr);
|
||||
|
||||
const exprs = z3.ast_from_string(modelStr);
|
||||
console.log(exprs);
|
||||
|
||||
})().catch(e => {
|
||||
console.error('error', e);
|
||||
process.exit(1);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue