Skip to content
Snippets Groups Projects
Commit 100929ba authored by Régis Blanc's avatar Régis Blanc
Browse files

handling 1 and -1 in eval

parent 3d739eb7
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ object SatFun { ...@@ -18,7 +18,7 @@ object SatFun {
case class ClauseLit(value: Boolean) extends ClauseList case class ClauseLit(value: Boolean) extends ClauseList
def eval(formula: Formula, trueVars: Set[Int]): Boolean = formula match { def eval(formula: Formula, trueVars: Set[Int]): Boolean = formula match {
case Var(n) => trueVars.contains(n) case Var(n) => if(n == 1) true else if(n == -1) false else trueVars.contains(n)
case Not(f) => !eval(f, trueVars) case Not(f) => !eval(f, trueVars)
case And(f1, f2) => eval(f1, trueVars) && eval(f2, trueVars) case And(f1, f2) => eval(f1, trueVars) && eval(f2, trueVars)
case Or(f1, f2) => eval(f1, trueVars) || eval(f2, trueVars) case Or(f1, f2) => eval(f1, trueVars) || eval(f2, trueVars)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment