Actually I'm not sure how complicated your clauses can become, I'm a bit too busy to dive in now.
But the example given in the OP should be solvable by filling 3 zeros for each clause and applying simple deduction rules on the 3x3 cuts.
I think the strength of prolog comes to play if you apply more complicated rules.
Please don't take this as a critic of your work, just theoretical observations. :)
update
Applying the rules given on a 3x3x3 matrix displayed by 3 cuts by name:
- like The one who likes apples is not a blacksmith => 3 zeroes at (apple&blacksmith) x names.
- and so on:
FRUITS PROFESSIONS NAMES
W B F
pineapples
apples 0 0 John
pears 0 0 0
pineapples 0
apples 0 0 0 Patrick
pears 0
pineapples 0 0 0
apples 0 0 0 James
pears 0
Deductions:
- The apple cut has only one free field
- => John is a witcher who likes apples
- All free fields in the witcher and John cut must be filled with zeroes.
FRUITS PROFESSIONS NAMES
W B F
pineapples 0 0 0
apples 1 0 0 John
pears 0 0 0
pineapples 0
apples 0 0 0 Patrick
pears 0
pineapples 0 0 0
apples 0 0 0 James
pears 0 0
Deductions:
- The James cut has only one field free
- => James is a blacksmith who likes pears.
- the remaining fields in blacksmith and pears cut are filled with zeroes.
FRUITS PROFESSIONS NAMES
W B F
pineapples 0 0 0
apples 1 0 0 John
pears 0 0 0
pineapples 0 0
apples 0 0 0 Patrick
pears 0 0 0
pineapples 0 0 0
apples 0 0 0 James
pears 0 1 0
- Only one field free
- => Patrick is a fisherman who like pineapples.
I did it manually, hope everything is right and I made the technique of a solver clearer.
I think you need more complicated rules to challenge people and take advantage of the power of prolog. :)
|