Last active
December 26, 2015 01:29
-
-
Save alterakey/7071473 to your computer and use it in GitHub Desktop.
Solver for that riddle...
This file contains hidden or 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
import itertools | |
everybody = ['akira', 'shinya', 'hiroshi', 'chiaki', 'saki', 'yuri', 'mika', 'reina'] | |
akira, shinya, hiroshi, chiaki, saki, yuri, mika, reina = everybody | |
def conds(p): | |
return ( | |
# no self cites | |
p[0] not in (shinya, reina, hiroshi, yuri) | |
and p[1] not in (mika, chiaki) | |
and p[2] not in (mika, ) | |
and p[4] not in (chiaki, mika) | |
#and p[5] not in (akira, saki) # possible self cite | |
and p[6] not in (saki, chiaki) | |
and p[7] not in (saki, reina) | |
# mouth-no_mouth | |
and p[7] not in (mika, ) | |
# glasses | |
and chiaki in (p[2], p[5]) | |
# girls | |
and yuri not in (p[1], p[4], p[6]) | |
and saki not in (p[1], p[4], p[6]) | |
# girls only | |
and p[3] not in (saki, chiaki) | |
# boys | |
and (akira in (p[1], p[4], p[6]) or akira not in (p[0], p[3])) | |
and (reina in (p[1], p[4], p[6]) or reina not in (p[0], p[3])) | |
# backdoor only | |
and p[1] not in (shinya, akira) | |
# straight | |
and saki not in (p[0], p[2]) | |
# derivates => free factors | |
and p[6] == akira # possible affection | |
and (p[1] == hiroshi and p[3] == yuri) | |
) | |
for p in itertools.ifilter(conds, itertools.permutations(everybody)): | |
print p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment