Re: a problem to solve

2006-03-27 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > And furthermore, having Python's bitwise operators > is nice, but it's not nice enough. I need the bitwise > functionality gmpy provides that's not available in > Python: scan for position of least significant 1 or 0, Cute tricks (artifact of two's complement notation):

Re: a problem to solve

2006-03-26 Thread [EMAIL PROTECTED]
Clemens Hepper wrote: > Hi, > > [EMAIL PROTECTED] wrote: > > That's one way to do it. I did it that way because I have the > > hex patterns memorized. > > You should be able to generate your numbers like this: > > number = int('001001000100100', 2) Well, that would be another way, wouldn't it?

Re: a problem to solve

2006-03-26 Thread Clemens Hepper
Hi, [EMAIL PROTECTED] wrote: > That's one way to do it. I did it that way because I have the > hex patterns memorized. You should be able to generate your numbers like this: number = int('001001000100100', 2) mfg - eth -- http://mail.python.org/mailman/listinfo/python-list

Re: a problem to solve

2006-03-25 Thread John Salerno
[EMAIL PROTECTED] wrote: > Well, I don't get the prize for most elegant. > > But that's partly because I included the ooloop6 > function. :: snip a bunch of scary code :: :) Wow, that's impressive. My solution looks a whole lot simpler than yours, but I certainly could not have done it witho

Re: a problem to solve

2006-03-25 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] 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 > c

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] 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 h

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > John Salerno wrote: >> John Salerno wrote: >>> [EMAIL PROTECTED] wrote: >>> No. First of all, combining them with the & operator would be the asnswer to having all four lamps lit in the same position. But you want exactly 3 (in any combination). The correct

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > John Salerno wrote: > > [EMAIL PROTECTED] wrote: > > > >> No. First of all, combining them with the & operator would be > >> the asnswer to having all four lamps lit in the same position. > >> But you want exactly 3 (in any combination). The correct way > >> to combine the sw

Re: a problem to solve

2006-03-24 Thread John Salerno
John Salerno wrote: > [EMAIL PROTECTED] wrote: > >> No. First of all, combining them with the & operator would be >> the asnswer to having all four lamps lit in the same position. >> But you want exactly 3 (in any combination). The correct way >> to combine the switches (using my answer of a[7] b[

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > No. First of all, combining them with the & operator would be > the asnswer to having all four lamps lit in the same position. > But you want exactly 3 (in any combination). The correct way > to combine the switches (using my answer of a[7] b[2] c[5] d[3]) > is to use th

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > >> (homework? a puzzle book?), I am just > >> wondering where the puzzle came from. > > > > The OP mentioned it came from a puzzle game That made me > > think there was likely at least one solution. > > Right, a computer puzzle game (a Myst-style

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > > You have 4 panels, each with 20 lamps (label them 19 to 0): > > > > panel A > > panel B > > panel C > > panel D > > I'm sorry for being so dense, but I don't und

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > > 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,0x

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > 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,0x

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > You have 4 panels, each with 20 lamps (label them 19 to 0): > > panel A > panel B > panel C > panel D I'm sorry for being so dense, but I don't understand this. There are four panels,

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: >> (homework? a puzzle book?), I am just >> wondering where the puzzle came from. > > The OP mentioned it came from a puzzle game That made me > think there was likely at least one solution. Right, a computer puzzle game (a Myst-style game called Realms of Illusion), an

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
Michael Tobis wrote: > Yeah, I misread the question, but the gist of my query remains. > > > The odds are 100% if there is at least one solution. > > Let's not get too philosophical. My question was whether there was an a > priori reason for believing that there is a solution. > > > You want perm

Re: a problem to solve

2006-03-24 Thread Michael Tobis
Yeah, I misread the question, but the gist of my query remains. > The odds are 100% if there is at least one solution. Let's not get too philosophical. My question was whether there was an a priori reason for believing that there is a solution. > You want permutations with replacement, so there

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] 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

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
Michael Tobis wrote: > First do a little estimation. We know we have to find four out of 16 > switches, 4 panels, eight switches each, 32 total. > so the number of possibilities to search is only C(4,16) = > 1820, so an exhaustive search will work. Yes, but for the wrong reason. It's not combina

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
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 ea

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > > Then you'll want to represent the lights as a 20-bit binary number. > > > > Each bit position corresponds to 4 lamps > > I'm not sure I understand that. If I use a 20-bit number, wouldn't each > bit correspond to a single light on each switch? Wh

Re: a problem to solve

2006-03-24 Thread Michael Tobis
First do a little estimation. We know we have to find four out of 16 switches, so the number of possibilities to search is only C(4,16) = 1820, so an exhaustive search will work. These will turn on 15 lights in each set of 20, of which the number of possibilities is C(15,20)**4 = 57779667567968256

Re: a problem to solve

2006-03-24 Thread John Salerno
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? Do I need to figure

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > Then you'll want to represent the lights as a 20-bit binary number. > > Each bit position corresponds to 4 lamps I'm not sure I understand that. If I use a 20-bit number, wouldn't each bit correspond to a single light on each switch? What do you mean that each bit is

Re: a problem to solve

2006-03-22 Thread [EMAIL PROTECTED]
John Salerno wrote: > Ok, here's a problem I've sort of assigned to myself for fun, but it's > turning out to be quite a pain to wrap my mind around. It's from a > puzzle game. It will help if you look at this image: > > http://www.johnjsal.devisland.net/switches.jpg > > Here's the situation: Each

Re: a problem to solve

2006-03-22 Thread Claudio Grondi
John Salerno wrote: > Ok, here's a problem I've sort of assigned to myself for fun, but it's > turning out to be quite a pain to wrap my mind around. It's from a > puzzle game. It will help if you look at this image: > > http://www.johnjsal.devisland.net/switches.jpg > > Here's the situation: E

a problem to solve

2006-03-22 Thread John Salerno
Ok, here's a problem I've sort of assigned to myself for fun, but it's turning out to be quite a pain to wrap my mind around. It's from a puzzle game. It will help if you look at this image: http://www.johnjsal.devisland.net/switches.jpg Here's the situation: Each of the four rows in the diagra