fork of finitedomain
This is a finite domain reduction system and solver combined. The fdq package combines fdo and fdq together.
After the customary npm install fdq
, you can find the main entry point in FDQ.solve(problem, fdpOptions, fdoOptions)
.
For example:
import FDQ from 'fdq';
let solution = FDQ.solve(`
: A, B, C [0 1]
A != B
A !& C
`);
log(solution); // -> {A: 0, B: 1, C: 1}
There is a REPL (online web-based playground) available: https://pvdz.github.io/fdq/examples/playground.html
Some examples:
To set up a development environment create a main project dir. Inside it clone the following repos:
Run npm install
and you should be able to use the CLI tools.
Grunt scripts:
grunt clean
- remove build
and dist
grunt build
- concat all the source files from fdlib
, fdo
, and fdp
together and babel them to es5grunt dist
- lint, test, build, and minify, this creates the final dist buildgrunt distq
- dist build only, also generates a more generic fdq.js
grunt distbug
- like build but instead of minify keeps development mnemonics like logging and assertionsgrunt distheat
- like build instead of minify does a beautifygrunt test
- lint and test, also copies to fdq.js
grunt testq
- distq and run tests, collect all errors, also copies to fdq.js
grunt testb
- distb and run tests, collect all errors, also copies to fdq.js
grunt testh
- disth and run tests, collect all errors, also copies to fdq.js
grunt testtb
- distq and run tests, fail fast, also copies to fdq.js
Note: for the build scripts, dist/fdq.js
is a generic output file for both dev and dist builds (since they also create descriptive output files, fdq.js
just makes it easy to reference from tests or web no matter which build script you ran).
NPM scripts:
npm run coverage
- runs mocha, istanbul, and isparta to generate code coverage of all the testsnpm run lint
- runs eslintnpm run lintdev
- runs eslint with slightly relaxer rules (like allowing console.log
)npm run lintfix
- runs eslint with the --fix option to automatically fixup certain rules quickly