Skip to content

Commit aaa5e93

Browse files
Fix for duplicate assertions in memory.
1 parent 737ba14 commit aaa5e93

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const backChain = function(goal, assertions) {
5656
trueAssertion = backChain(premise, assertions);
5757

5858
// Add the assertion to the assertion list.
59-
trueAssertion && assertions.push(trueAssertion);
59+
trueAssertion && !assertions.some(assertion => assertion.attribute === trueAssertion.attribute && assertion.value === trueAssertion.value) && assertions.push(trueAssertion);
6060

6161
// Is the trueAssertion equal to the premise?
6262
isPremiseAssertionTrue = JSON.stringify(premise) === JSON.stringify(trueAssertion);

0 commit comments

Comments
 (0)