Last active
December 29, 2015 03:39
-
-
Save marclundgren/7609130 to your computer and use it in GitHub Desktop.
3 gods, true, false, random
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Three gods A, B, and C are called, in no particular order, True, False, and Random. | |
True always speaks truly, False always speaks falsely, but whether Random speaks truly or falsely is a completely random matter. | |
The gods understand English, but will answer all questions in their own language, in which the words for yes and no are da and ja, in some order. You do not know which word means which. | |
*/ | |
(function() { | |
function randomBool () { | |
return !! Math.round(Math.random() * 1); | |
} | |
var GODS = { | |
TRUE: true, | |
FALSE: false, | |
RANDOM: randomBool() | |
}; | |
/* Determines the identities of A, B, and C by asking three yes-no questions | |
each question must be put to exactly one god | |
*/ | |
function determineWhoisWHo() { | |
/* The gods understand English, | |
but will answer all questions in their own language, | |
in which the words for yes and no are da and ja, in some order. | |
(You do not know which word means which...) | |
*/ | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment