[ExI] intermittent liar
Aware
aware at awareresearch.com
Wed Feb 2 07:05:28 UTC 2011
2011/1/22 spike <spike66 at att.net>:
> Oh my, I found a most excellent puzzle today. I found an answer, don’t know
> yet if it is right. See what you find:
The mechanical no-brainer method:
#!/usr/bin/env python
"""
Larry always tells lies during months that begin with vowels but always tells
the truth during the other months. During one particular month, Larry makes
these two statements:
- I lied last month.
- I will lie again six months from now.
During what month did Larry make these statements?
"""
months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split()
vowels = ('A', 'E', 'I', 'O', 'U')
truth_months = [m for m in months if not m.startswith(vowels)]
def displace(month, disp):
return months[(months.index(month) + disp) % 12]
def asserts(month):
return [displace(month, -1) not in truth_months,
displace(month, 6) not in truth_months]
for month in months:
if (month in truth_months and
all(asserts(month))
or
month not in truth_months and
not any(asserts(month))):
print month
Result: Aug
More information about the extropy-chat
mailing list