naive-3-sat
Version:
naive solver for the 3-sat problem
20 lines (16 loc) • 539 B
JavaScript
const { NaiveSat } = require('./NaiveSat');
const repl = require('repl');
const replServer = repl.start({ prompt: '> ' });
replServer.defineCommand('sat', {
help: 'try typing: .sat <expr>, where <expr> is an expression for which to calculate satisfibility, ex. ((!a & b) | (b | c)) & (c & !a)',
action(expr) {
this.clearBufferedCommand();
const naiveSat = new NaiveSat(expr);
naiveSat.printSat();
this.displayPrompt();
}
});
replServer.on('exit', () => {
console.log('exiting program...');
process.exit();
});