a problem to solve

mensanator at aol.com mensanator at aol.com
Fri Mar 24 23:22:27 CET 2006

mensanator at aol.com wrote:
> John Salerno wrote:
> > John Salerno wrote:
> >
> > > Anyway, any advice for how to proceed would be great! I hope I described
> > > it well enough.
> >
> > Ok, after reading the suggestions, I feel better about proceeding. But
> > one question: how exactly do I come up with 32 different 20-bit integers
> > for each switch?
> Eight numbers for each switch, 32 total.

Should be:  Eight numbers for each panel, 32 total.

> Make a list for each panel and in each list, put in eight binary
> numbers using the position in the list to represent the switch number.
> So we'll want to label our switches 0-7.
> > Do I need to figure out the bits for each one manually?
> Yes, you get them from your diagram showing which lamps are
> lit for each switch.
> > And how is this written in Python? Using hex?
> That's one way to do it. I did it that way because I have the
> hex patterns memorized.
> I have already gone to the trouble of converting all your patterns to
> hex numbers, if you're interested. If you want to do it yourself,
> simply ignore this.
> a = [0xf5fdc,0xf6edb,0xbddb7,0x6fddd,0xeb7ed,0xb977f,0xbfed3,0xedef5]
> b = [0xddb7d,0xfaddb,0xde75f,0xeef7a,0xdd77b,0xdfbce,0xb77dd,0x7ef5d]
> c = [0xf37bd,0xdfaee,0xddd6f,0xddfb6,0xb9efb,0xb7bbe,0xecfbd,0xb75df]
> d = [0x77edb,0xbb7ee,0xdf773,0x7bdeb,0x7ddaf,0xdeeeb,0xfb35f,0xbb7dd]
> Now since the panels are now lists, we use an index representing
> the switch to retrieve the lamps lit by that switch.
> Refering to my original boolean equation, replace A1 by a[0],
> B1 by b[0], etc. to evaluate that set of switches.
> Once you see that a[0],b[0],c[0],d[0] is not a solution, try a
> different set of switches. Repeat until you find a set that works.
> There is, in fact a solution, but I won't reveal it unless you ask.
> If you need help in figuring out how to walk through all 4096 possible
> switch sets, just ask.

More information about the Python-list mailing list