Created
December 9, 2019 10:50
-
-
Save dionyziz/234872d074632b8c409ce423505182b5 to your computer and use it in GitHub Desktop.
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
def ask(r): | |
p <- [0, 1] # define whether we will speak the truth or not | |
s <- [0, 1] # define "ya" as "yes" or "no" randomly | |
if r: # question has truthful answer | |
if p: # we are speaking the truth | |
if s: # the meaning of "ya" is "yes" | |
return "ya" | |
else: | |
return "da" | |
else: # we are lying | |
if s: # the meaning of "ya" is "yes" | |
return "da" | |
else: | |
return "ya" | |
else: # the question has falsy answer | |
if p: # we are speaking the truth | |
if s: # the meaning of "ya" is "yes" | |
return "da" | |
else: | |
return "ya" | |
else: # we are lying | |
if s: # the meaning of "ya" is "yes" | |
return "ya" | |
else: | |
return "da" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment