I've been struggling with puzzle 3 of Knights assignment. Any help would be appreciated. Seems like the issue is in depicting the statement B says "A said 'I am a knave'."
Below is my code
# Puzzle 3
# A says either "I am a knight." or "I am a knave.", but you don't know which.
# B says "A said 'I am a knave'."
# B says "C is a knave."
# C says "A is a knight."
knowledge3 = And(
# A says either "I am a knight." or "I am a knave.", but you don't know which.
Implication(AKnight, And(Or(AKnave, AKnight), Not(And(AKnave, AKnight)))),
Implication(AKnave, Not(And(Or(AKnave, AKnight), Not(And(AKnave, AKnight))))),
# B says "A said 'I am a knave'."
Implication(BKnight, Or((Implication(AKnight, AKnave)), (Implication(AKnave, Not(AKnave))))),
Implication(BKnave, Not(Or((Implication(AKnight, AKnave)),(Implication(AKnave, Not(AKnave)))))),
# B says "C is a knave."
Implication(BKnight, CKnave),
Implication(BKnave, Not(CKnave)),
# C says "A is a knight."
Implication(CKnight, AKnight),
Implication(CKnave, Not(AKnight)),
# A is either a Knight or Knave, not both
Or(AKnave, AKnight), Not(And(AKnave, AKnight)),
# B is either a Knight or Knave, not both
Or(BKnave, BKnight), Not(And(BKnave, BKnight)),
# C is either a Knight or Knave, not both
Or(CKnave, CKnight), Not(And(CKnave, CKnight))
)