Canna71 / CSPjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSPjs

Simple library to do Constraint Satisfaction Problem

import { solve, enforceConstraint, Problem} from "cspjs"
import util from "util"

const variables = {
    "a": [1,2,3,4],
    "b": [1,2,3,4]
}

const problem : Problem = {
    variables,
    constraints: [
        {head:"a", tail:"b", predicate: (h,t)=>h+t===h*t}
    ]
}

const solutions = solve(problem)
const firstSol = solutions.next()

About


Languages

Language:TypeScript 64.2%Language:JavaScript 35.8%