a problem to solve

John Salerno johnjsal at NOSPAMgmail.com
Sat Mar 25 08:19:52 CET 2006


mensanator at aol.com wrote:

> If you need help in figuring out how to walk through all 4096 possible
> switch sets, just ask.

Ok, thanks to your list, I figured out a program that works! It's 
probably not the best, and it doesn't really display which switches are 
correct in any apparent way (you have to look for them in the list), but 
it works! Here's the code. I'd love to see your implementation too.

from gmpy import digits

panelOne = [0xf5fdc,0xf6edb,0xbddb7,0x6fddd,0xeb7ed,0xb977f,0xbfed3,0xedef5]
panelTwo = [0xddb7d,0xfaddb,0xde75f,0xeef7a,0xdd77b,0xdfbce,0xb77dd,0x7ef5d]
panelThree = 
[0xf37bd,0xdfaee,0xddd6f,0xddfb6,0xb9efb,0xb7bbe,0xecfbd,0xb75df]
panelFour = 
[0x77edb,0xbb7ee,0xdf773,0x7bdeb,0x7ddaf,0xdeeeb,0xfb35f,0xbb7dd]

for a in panelOne:
	for b in panelTwo:
		for c in panelThree:
			for d in panelFour:
				if (a & b & (c ^ d)) | (c & d & (a ^ b)) == 1048575:
					print 'Solution is:', digits(a, 16), digits(b, 16), digits(c, 16), 
digits(d, 16)
					raw_input()



More information about the Python-list mailing list