# The jackal, the lion, the parrot and the giraffe - logic puzzle

Here is a puzzle that appeared in a Russian magazine named Kvantik (see Tanya Khovanova's Math Blog). [The trick lies in that we don't know exactly what the hedgehog knows at each stage. The symbology of the animals and their behaviour is great too.]

The Jackal always lies; the Lion always tells the truth. The Parrot repeats the previous answer—unless he is the first to answer, in which case he babbles randomly. The Giraffe replies truthfully, but to the previous question directed to him—his first answer he chooses randomly.

The Wise Hedgehog in the fog stumbled upon the Jackal, the Lion, the Parrot, and the Giraffe, although the fog prevented him from seeing them clearly. He decided to figure out the order in which they were standing.

After he asked everyone in order, “Are you the Jackal?” he was only able to figure out where the Giraffe was.

After that he asked everyone, “Are you the Giraffe?” in the same order, and figured out where the Jackal was.

But he still didn’t have the full picture. He started the next round of questions, asking everyone, “Are you the Parrot?” After the first one answered “Yes”, the Hedgehog understood the order.

What is the order?

Is there a neat way of solving the puzzle using symbolic logic?

### Round 1

Both the lion and the jackal must say "No" to the first question. If the parrot and the giraffe both say "No" then nothing is revealed. If they both say "Yes" then it will not be possible to know only where the giraffe is. Therefore, one must say "Yes" and the other "No". Again, if "Yes" is the first answer, nothing is revealed, but if it follows a sequence of "No" answers then it must be announced by the giraffe. The giraffe is thus not first. The parrot cannot follow the giraffe (unless the parrot is first and the giraffe last).

### Round 2

Both the lion and the giraffe must say "No" to the second question, while the jackal must say "Yes". If the parrot says "Yes", then it is not possible to know where the jackal is without also knowing where the parrot is. So, the parrot says "No". If the jackal were first, then the parrot's position would be known since it does not follow either the giraffe (known position) or the jackal. Likewise, if the jackal were second, the parrot's position would again be known. If the jackal were third, the giraffe would be last. But then the parrot's position would be known from the giraffe's first answer. So the jackal must be last.

### Round 3

???

• By the parrot "babbles randomly", do you mean it gives a random answer, or it says something gibberish/ nonsensical, i.e. not yes or no? – Cataline Jul 23 '15 at 2:17
• It says either yes or no. – Marconius Jul 23 '15 at 2:46

Round 1

From your answer we know that the hedgehog saw one of these three possible answers: NYNN, NNYN,NNNY

where the one who said yes is the giraffe.

Round 2

In this round the jackal will lie by saying yes, the giraffe will say no answering the previous question and the lion will also say no by saying the truth.

Then we don't know what will say the parrot. Let's assume he said yes, then it would mean that the pattern would be something like: YYNN, But this would be no good since by knowing where is the giraffe (which will say no) we would also know the position of the lion because it's the other one who would say no.

Thus we know that there are 3 yes and 1 no. In particular as stated in your answer, the jackal must be last, we must then check if NNNY is consistent with one of the above 3 possible cases.

In the end we will have:

NNYN->NNNY

Which implies OOGJ

Round 3

We notice that if the answer is yes the only one who could have said it is actually the parrot and not the lion, then the (hopefully) right answer is:

PLGJ