0
0

Can you solve "the hardest logic puzzle ever"?


               
2017 Feb 22, 7:15pm   1,489 views  3 comments

by Dan8267   follow (4)  

Stop the video at 1:05 if you want to solve the problem yourself. I highly recommend trying to do so.

www.LKvjIsyYng8

I misinterpret what they were asking, but I solved a logically equivalent problem. They want you to figure out which artifact goes with which alien god knowing the name of the god the artifact belongs to but not knowing which god is which. I solved figuring out which artifact goes with which alien god knowing the gods by name but not knowing which artifact belongs to which god. This might seem like a different problem, but it's not. The solution is the same.

I'll post my solution below here. Don't look at it if you want to try to solve the puzzle yourself.














































I solved the puzzle using a spreadsheet, a venn diagram, some predicate logic, and a values table (generalization of a truth table). Again, a logically equivalent but reworded puzzle since I misinterpreted what they were asking. However, the problem and the solution are identical to the intended one.

First, I considered all the permutations of which artifact goes with which god. There are 3! or 6 combinations which I list as states 1 through 6 and describe by which god (r, f, t) gets which artifact (z, y, x). This is shown below. Ignore the a1, a2, a3 for now.

Then I split the permutations, states 1 through 6, into three partitions. Each partition divided the set of permutations into two equal subsets while the intersections of either side of each partition results in a single state. Thus I have three questions that can determine what state you are in if you know which word means yes, ulu or ozo. If you don't, then you have two possible answers.

So those a1, a2, and a3 columns in the above picture reflect the answers needed to perform the partitioning shown in the next picture.

Next I generated questions that would provide the answers a1, a2, a3. A check are "yes", which for now we'll assume to be "ulu". A cross is a "no".

The questions I asked are in predicate form using the following notation. Again, I'm tabling the question of which alien word means yes for right now.
t(x) = Does Tee own X?
t'(x) = Does Tee say yes to the question "Does Tee own X?"?
f'(t(x)) = Does Eff say yes to the question "Does Tee own X?"?

So, here are my questions and the expected answers in the alien language for each state whether "ulu" means yes or no. s1 is logical statement 1, which is use to generate question 1.

The final part of solving the puzzle is realizing that you can eliminate not knowing which alien word means yes. This was quite easy to me since I've done a lot of JavaScript programming and JavaScript truthiness is much like the alien language. In JavaScript you would say something like "if (a === true)" rather than "if (a)" or "if (a == true)" in order to force a strict logical operation. Similarly, the variance introduced by not knowing if "ulu" is yes/true or no/false can be cancelled out with the expression "a equals ulu".

So my questions generated from the statements I want evaluated to partition the set of cases will not rely on knowing which alien word means yes. Those questions are...

The answers to these questions for any given state and meaning of ulu/ozo will result in a single match as shown in the above spreadsheet.

To confirm that the solution is correct, I created a program that completely models the problem and executes the solution checking the result of all 12 cases. There are six states and two possible meanings of the alien's answers, so there are six times two or twelve cases. Below is the program's source and output. Hopefully PatNet won't screw up the formatting too badly.

using System;
using System.Collections.Generic;

namespace ThreeGods
{
    enum Answer { ulu, ozo };

    enum AnswerMeaning { uluIsYes, uluIsNo };

    enum Artifact { x, y, z };

    class State
    {
        public Artifact t;
        public Artifact f;
        public Artifact r;

        // Answers if ulu is yes.  Negation of answer is ulo is no.
        public Answer a1;
        public Answer a2;
        public Answer a3;

        public override String ToString ()
        {
            return String.Format("(r = {0}, f = {1}, t = {2})", r, f, t);
        }
    }

    class Program
    {
        static void Main (String[] args)
        {
            List <State> states = CreateAllStatePermutations();
            int caseCounter = 1;

            foreach (AnswerMeaning answerMeaning in Enum.GetValues(typeof(AnswerMeaning)))
                foreach (State state in states)
                {
                    Answer a1 = AskTeeIsUluTheAnswerToDoesArrOwnZOrBothArrOwnsYAndTeeOwnsX(answerMeaning, state);
                    Answer a2 = AskTeeIsUluTheAnswerToDoesEffOwnXOrBothEffOwnsZAndTeeOwnsX(answerMeaning, state);
                    Answer a3 = AskTeeIsUluTheAnswerToDoesArrOwnZOrBothArrOwnsXAndTeeOwnsZ(answerMeaning, state);

                    State expectedState = DetermineState(states, answerMeaning, a1, a2, a3);

                    if (expectedState == state)
                        Console.WriteLine(String.Format("Case {0}, correctly determined being in state {1}.", caseCounter, state));
                    else
                        Console.WriteLine(String.Format("Case {0}, incorrectly determined state.
Expected state {1}.
Actual state   {2}.", caseCounter, expectedState, state));

                    caseCounter++;
                }

            Console.WriteLine("Press [ENTER] to terminate program.");
            Console.ReadLine();
        }

        static List <State> CreateAllStatePermutations ()
        {
            List <State> states = new List <State> ();

            states.Add(new State() { r = Artifact.z, f = Artifact.y, t = Artifact.x, a1 = Answer.ulu, a2 = Answer.ozo, a3 = Answer.ulu });
            states.Add(new State() { r = Artifact.z, f = Artifact.x, t = Artifact.y, a1 = Answer.ulu, a2 = Answer.ulu, a3 = Answer.ulu });
            states.Add(new State() { r = Artifact.y, f = Artifact.z, t = Artifact.x, a1 = Answer.ulu, a2 = Answer.ulu, a3 = Answer.ozo });
            states.Add(new State() { r = Artifact.y, f = Artifact.x, t = Artifact.z, a1 = Answer.ozo, a2 = Answer.ulu, a3 = Answer.ozo });
            states.Add(new State() { r = Artifact.x, f = Artifact.z, t = Artifact.y, a1 = Answer.ozo, a2 = Answer.ozo, a3 = Answer.ozo });
            states.Add(new State() { r = Artifact.x, f = Artifact.y, t = Artifact.z, a1 = Answer.ozo, a2 = Answer.ozo, a3 = Answer.ulu });

            return states;
        }

        static Answer AskTeeIsUluTheAnswerToDoesArrOwnZOrBothArrOwnsYAndTeeOwnsX (AnswerMeaning answerMeaning, State state)
        {
            bool matchedArtifact = state.r == Artifact.z || (state.r == Artifact.y && state.t == Artifact.x);

            Answer answer = DetermineSpokenAnswer(answerMeaning, matchedArtifact);

            return answer;
        }

        static Answer AskTeeIsUluTheAnswerToDoesEffOwnXOrBothEffOwnsZAndTeeOwnsX (AnswerMeaning answerMeaning, State state)
        {
            bool matchedArtifact = state.f == Artifact.x || (state.f == Artifact.z && state.t == Artifact.x);

            Answer answer = DetermineSpokenAnswer(answerMeaning, matchedArtifact);

            return answer;
        }

        static Answer AskTeeIsUluTheAnswerToDoesArrOwnZOrBothArrOwnsXAndTeeOwnsZ (AnswerMeaning answerMeaning, State state)
        {
            bool matchedArtifact = state.r == Artifact.z || (state.r == Artifact.x && state.t == Artifact.z);

            Answer answer = DetermineSpokenAnswer(answerMeaning, matchedArtifact);

            return answer;
        }

        static Answer DetermineSpokenAnswer (AnswerMeaning answerMeaning, bool matchedArtifact)
        {
            return (matchedArtifact && answerMeaning == AnswerMeaning.uluIsYes)
                || (!matchedArtifact && answerMeaning == AnswerMeaning.uluIsNo)
                ?  Answer.ulu
                :  Answer.ozo;
        }

        static State DetermineState (List <State> states, AnswerMeaning answerMeaning, Answer a1, Answer a2, Answer a3)
        {
            if (answerMeaning == AnswerMeaning.uluIsNo)
            {
                a1 = a1 == Answer.ulu ? Answer.ozo : Answer.ulu;
                a2 = a2 == Answer.ulu ? Answer.ozo : Answer.ulu;
                a3 = a3 == Answer.ulu ? Answer.ozo : Answer.ulu;
            }

            foreach (State state in states)
                if (state.a1 == a1 && state.a2 == a2 && state.a3 == a3)
                    return state;

            return null;
        }
    }
}

Output follows:
Case 1, correctly determined being in state (r = z, f = y, t = x).
Case 2, correctly determined being in state (r = z, f = x, t = y).
Case 3, correctly determined being in state (r = y, f = z, t = x).
Case 4, correctly determined being in state (r = y, f = x, t = z).
Case 5, correctly determined being in state (r = x, f = z, t = y).
Case 6, correctly determined being in state (r = x, f = y, t = z).
Case 7, correctly determined being in state (r = z, f = y, t = x).
Case 8, correctly determined being in state (r = z, f = x, t = y).
Case 9, correctly determined being in state (r = y, f = z, t = x).
Case 10, correctly determined being in state (r = y, f = x, t = z).
Case 11, correctly determined being in state (r = x, f = z, t = y).
Case 12, correctly determined being in state (r = x, f = y, t = z).
Press [ENTER] to terminate program.

And there you have it, the solution to the hardest logic puzzle ever. Well, maybe it's not really the hardest, but it did take me about two hours to figure out and half an hour to code up. I think my explanation is a lot clearer and more detailed than the video's. Using a value table really helps work through this problem particularly in generating the questions to ask. It turns out there are several triplets of questions you can ask to get the solution because there are that many ways to partition the set three times to get to a unique answer.

#scitech

Comments 1 - 3 of 3        Search these comments

1   Dan8267   2017 Feb 23, 11:18am  

Anyone figured this out? Anyone tried?

2   justme   2017 Feb 23, 12:08pm  

Not interested in trying. I don't mean to offend you, but puzzles are a waste of time unless they teach you a general principle for solving problems, and the skill of recognizing a given problem as belonging (or not) to a certain class of problems. In which case it is usually better simply better to learn the underlying mathematics. In this case, just studying some boolean algebra would probably be more useful for an average person.

3   Dan8267   2017 Feb 23, 12:16pm  

justme says

unless they teach you a general principle for solving problems,

This one teaches two general problem solving principles. I'd list them, but that would give away the answer. Well, actually they are listed in my solution above, but spoiler alert.

justme says

In which case it is usually better simply better to learn the underlying mathematics.

One of the most effective ways of learning mathematics and logic is with challenging problems.

Please register to comment:

api   best comments   contact   latest images   memes   one year ago   users   suggestions   gaiste