The code has
???? in each deductive arithmetic step. Replace
???? with the appropriate logical deduction formulas:
Q3,
Q2 - AltLie,
Q1 - Liars - AltLie,
Total - TruthTellers - Liars - AltLie, and
TruthTellers * 1. Then click
Run to let Prolog solve the AMC 10A puzzle!
Prolog will deduce:
TruthTellers = 7
Liars = 6
AltTruth = 9
AltLie = 9
CandyForTruthTellers = 7
1. Notice how $A_t$ (alternaters who started with truth) said
no to every question and received
$0$ pieces of candy!
2. In contrast, $A_l$ (alternaters who started with a lie) said
yes to every question and received
$3$ pieces of candy each ($27$ pieces in total)!