I'm trying to create an expert system which each time the user responds a question it creates a new fact (for example):
assert(like accion yes)
assert(like multi yes)
And once its done, it shows the name of every game that has those facts in their description:
(deffacts gaming (game Call_of_Duty multi accion)
(game BattleField multi strategy))
I tried using this rule, where I check if every "like-fact" is located inside an especific "game-fact", but it doesn't work:
(defrule conclusion
(like $?x yes)
(game ?y $?x2)
(test(member$ ?x ?x2))
=>
(printout t "You like the game: " ?y crlf))
Here's three different ways you can write the rule. Your original rule, conclusion-1, will print a message for each like that is matched by a game so you can get multiple prints for each game. Rule conclusion-2 prints a game if there is at least one like that matches the game. At most you will see a game printed once. Rule conclusion-3 will print a game only if it matches every like for that game.