I can't find mistakes in my code

My task is to write a code that must solve the following zebra-puzzle:
A family has 5 children. Their ages: 4, 5, 6, 7 and 8 years old. Their names: Rose, Becca, Iona, Stu, Rob. Each of them has a talent: piano, math, violin, literature, computer. I need to find out each child’s age and talent, if the following facts are known:

  1. Becca is 4 years old and doesn’t know math.
  2. A child, who know computer very well is one year older than Stu
  3. A 7 years old child plays violin
  4. Iona is not 8 years old
  5. Rob is 5 years old and he’s younger then a child whose talent is literature

I wrote the code, but it gives just “false” instead of correct result. Where did I make mistakes?

puzzle(Children) :-
    Children = [child('Becca', 4, _), 
              child('Rob', 5, _), 
              child(_, 6, _), 
              child(_, 7, 'Violin'), 
              child(_, 8, _)],
    member(child('Rose', _, _), Children),
    member(child(_, _, 'Piano'), Children),
    member(child('Becca', AgeB, TalentB), Children),
    member(child(_, AgeM, 'Mathematics'), Children),
    member(child('Stu', AgeS, TalentS), Children),
    member(child(_, AgeC, 'Computer'), Children),
    member(child('Iona', AgeI, _), Children),
    member(child('Rob', AgeR, TalentR), Children),
    member(child(_, AgeL, 'Literature'), Children),
    TalentB \= 'Mathematics',
    AgeM > AgeB,
    AgeS + 1 = AgeC,
    AgeS < 8,
    TalentS \= 'Computer',
    AgeI < 8,
    AgeL > AgeR,
    TalentR \= 'Literature'.
?- puzzle(_Children), member(child(Name, Age, Talent), _Children).

Change the line to:

AgeC is AgeS + 1,
1 Like

Thanks for help!