Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Day Knights and Night Knights

Day Knights and Night Knights

Scheduled Pinned Locked Moved The Lounge
question
11 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Russell Jones
    wrote on last edited by
    #1

    In an underground cavern where the sun cannot be seen and there are no clocks there live a tribe of Knights. These knights are divided into 2 types: those who tell the truth when it is day and lie when it is night (Day Knights) and those who tell the truth when it is night and lie during the day(Night Knights). It is impossible to tell the difference between the knights apart from the truthfullness of their answers. You desperately need to know whether it is day or night on the surface and infront of you are 2 knights; one is a day knight and the other a night knight. You may only ask one question of one of these knights. What would you ask?

    B L I P 4 Replies Last reply
    0
    • R Russell Jones

      In an underground cavern where the sun cannot be seen and there are no clocks there live a tribe of Knights. These knights are divided into 2 types: those who tell the truth when it is day and lie when it is night (Day Knights) and those who tell the truth when it is night and lie during the day(Night Knights). It is impossible to tell the difference between the knights apart from the truthfullness of their answers. You desperately need to know whether it is day or night on the surface and infront of you are 2 knights; one is a day knight and the other a night knight. You may only ask one question of one of these knights. What would you ask?

      B Offline
      B Offline
      Brady Kelly
      wrote on last edited by
      #2

      "Which one of you values your balls most?"

      1 Reply Last reply
      0
      • R Russell Jones

        In an underground cavern where the sun cannot be seen and there are no clocks there live a tribe of Knights. These knights are divided into 2 types: those who tell the truth when it is day and lie when it is night (Day Knights) and those who tell the truth when it is night and lie during the day(Night Knights). It is impossible to tell the difference between the knights apart from the truthfullness of their answers. You desperately need to know whether it is day or night on the surface and infront of you are 2 knights; one is a day knight and the other a night knight. You may only ask one question of one of these knights. What would you ask?

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        your puzzle is a bit flawed; the normal approach is you ask one what the other would answer to the question of interest, knowing one of them would insert an inverter (i.e. lie about it). However this assumes they know each other as to their truthfulness, which is not apparent from your original statement. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
        [The QA section does it automatically now, I hope we soon get it on regular forums as well]


        R 1 Reply Last reply
        0
        • L Luc Pattyn

          your puzzle is a bit flawed; the normal approach is you ask one what the other would answer to the question of interest, knowing one of them would insert an inverter (i.e. lie about it). However this assumes they know each other as to their truthfulness, which is not apparent from your original statement. :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
          [The QA section does it automatically now, I hope we soon get it on regular forums as well]


          R Offline
          R Offline
          Russell Jones
          wrote on last edited by
          #4

          You're right of course :rolleyes: I guess the knights also know that one of them is a day knight and the other is a night knight. They are also aware of which they are.

          H 1 Reply Last reply
          0
          • R Russell Jones

            You're right of course :rolleyes: I guess the knights also know that one of them is a day knight and the other is a night knight. They are also aware of which they are.

            H Offline
            H Offline
            hairy_hats
            wrote on last edited by
            #5

            But if they can't see the sun or a clock how do they know whether they should be lying or telling the truth at the moment you ask them?

            I hope you realise that hamsters are very creative when it comes to revenge. - Elaine

            R 1 Reply Last reply
            0
            • H hairy_hats

              But if they can't see the sun or a clock how do they know whether they should be lying or telling the truth at the moment you ask them?

              I hope you realise that hamsters are very creative when it comes to revenge. - Elaine

              R Offline
              R Offline
              Russell Jones
              wrote on last edited by
              #6

              They just know it, and they're knights which means they've got armour and brutal weapons so I'm not going to question their methods too closely.

              1 Reply Last reply
              0
              • R Russell Jones

                In an underground cavern where the sun cannot be seen and there are no clocks there live a tribe of Knights. These knights are divided into 2 types: those who tell the truth when it is day and lie when it is night (Day Knights) and those who tell the truth when it is night and lie during the day(Night Knights). It is impossible to tell the difference between the knights apart from the truthfullness of their answers. You desperately need to know whether it is day or night on the surface and infront of you are 2 knights; one is a day knight and the other a night knight. You may only ask one question of one of these knights. What would you ask?

                I Offline
                I Offline
                Ian Shlasko
                wrote on last edited by
                #7

                "Is it daytime?" If it's day: Day Knight (Truth): Yes Night Knight (Lies): No If it's night: Day Knight (Lies): Yes Night Knight (Truth): No Hence, whether it's day or night, a Day Knight would say yes, and a Night Knight would say no. Do I get a prize? EDIT: Oh wait, nevermind... You want to know whether it's day, not what kind of knights they are... I blame Monday morning. EDIT 2: Ok, I got it... "Is the other guy a Day Night?" If he says "No", it's daytime.

                Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)

                R 1 Reply Last reply
                0
                • I Ian Shlasko

                  "Is it daytime?" If it's day: Day Knight (Truth): Yes Night Knight (Lies): No If it's night: Day Knight (Lies): Yes Night Knight (Truth): No Hence, whether it's day or night, a Day Knight would say yes, and a Night Knight would say no. Do I get a prize? EDIT: Oh wait, nevermind... You want to know whether it's day, not what kind of knights they are... I blame Monday morning. EDIT 2: Ok, I got it... "Is the other guy a Day Night?" If he says "No", it's daytime.

                  Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)

                  R Offline
                  R Offline
                  Russell Jones
                  wrote on last edited by
                  #8

                  You even managed to answer my follow up question

                  I 1 Reply Last reply
                  0
                  • R Russell Jones

                    You even managed to answer my follow up question

                    I Offline
                    I Offline
                    Ian Shlasko
                    wrote on last edited by
                    #9

                    Just wait... Sometime after lunch, my brain will finish booting up for the day. Then you're all doomed!

                    Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)

                    1 Reply Last reply
                    0
                    • R Russell Jones

                      In an underground cavern where the sun cannot be seen and there are no clocks there live a tribe of Knights. These knights are divided into 2 types: those who tell the truth when it is day and lie when it is night (Day Knights) and those who tell the truth when it is night and lie during the day(Night Knights). It is impossible to tell the difference between the knights apart from the truthfullness of their answers. You desperately need to know whether it is day or night on the surface and infront of you are 2 knights; one is a day knight and the other a night knight. You may only ask one question of one of these knights. What would you ask?

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #10

                      I'd check my cell phone.

                      L 1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        I'd check my cell phone.

                        L Offline
                        L Offline
                        Luc Pattyn
                        wrote on last edited by
                        #11

                        you can't do that, its solar cells won't work in the underground cavern, and batteries hadn't been invented yet. :)

                        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                        I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
                        [The QA section does it automatically now, I hope we soon get it on regular forums as well]


                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups