• Sophienomenal@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    3 days ago

    For those interested, ignoring the contradictory presentation of the riddle (as the knights themselves would not say the riddle since one always lies and one always tells the truth), the solution is simple. Ask the knights what the other knight would answer when asked what door is correct, and they will both say which path not to go to. Thus you pick the path that neither Knight says!

    Logic:

    Liar: Will say the wrong option, as they're being asked which door the truth telling knight would say (and they will lie about what the truth-teller would say)
    ------------------------------------------
    Truth-teller: Will say the wrong option, as they're being asked which door the liar would say (and they'll tell the truth about that)
    

    NOTE: This can be expanded to a case with n doors by asking the knights to provide all the options that the other knight could say, and each will provide n-1 options, so you’d pick the one option that neither knight says. It is possible the liar may not list all options, but the truth-teller would, so the problem could still be worked out regardless (and you’d know which knight is the liar in that case).

  • Riskable@programming.dev
    link
    fedilink
    English
    arrow-up
    29
    ·
    4 days ago

    Oooh! This is a great solution to this problem! Just write down both numbers and perform a luhn check:

    https://en.wikipedia.org/wiki/Luhn_algorithm

    The one that lies only has a 1 in 10 chance of making up a number that will pass the check! Cool shortcut: If it starts with a 1, 2, 7, 8, or 9, they’re lying. Those are reserved for things that aren’t credit cards 👍

  • Dagnet@lemmy.world
    link
    fedilink
    English
    arrow-up
    24
    ·
    4 days ago

    This kinda falls apart with the knights talking at the start. Either there is 1 that only tells truth with the other not being bound by those rules or one that only tells lies with the other one doing whatever since one of those 2 is telling a lie.

    • Cris@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      16
      ·
      4 days ago

      That’s a good point actually, they kinda messed that part up a bit

  • petersr@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 days ago

    Am I mistaken for recalling that in the original riddle, the question should have a boolean outcome (yes/no)?

    Having a question with a big domain makes it a lot easier to guess what is a false and true outcome.

  • PrivateNoob@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    4 days ago

    The easiest solution is to ask what is the color of their capes that they are wearing