simultaneous assignment
Gary Duzan
mgi820 at motorola.com
Tue May 2 16:47:58 EDT 2006
In article <RAN5g.2037$No6.43926 at news.tufts.edu>,
John Salerno <johnjsal at NOSPAMgmail.com> wrote:
>bruno at modulix wrote:
>
>> Now if I may ask: what is your actual problem ?
>
>Ok, since you're so curious. :)
>
>Here's a scan of the page from the puzzle book:
>http://johnjsalerno.com/spies.png
>
>Basically I'm reading this book to give me little things to try out in
>Python. There's no guarantee that this puzzle is even conducive to (or
>worthy of) a programming solution.
Exhaustive search is quite practical for this problem:
[(x,y,z,w) for x in (True, False)
for y in (True, False)
for z in (True, False)
for w in (True, False)
if spy(x,y,x,w)]
Given the appropriate spy() function, this will return a set of
values for the truthful (logically coherent) spy and nothing for
the other spy. The details are left as an exercise for the reader.
:-)
Gary Duzan
Motorola CHS
More information about the Python-list
mailing list