Re: Working out yes/no possibilities

2009-11-25 Thread Leigh _

INNER JOIN @question q2 ON 1 = 1

{Psst ... Cross join} ;-) 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328659
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-25 Thread Ian Skinner

So, this problem has been sitting in my kitchen.  The math has been 
proved and a good solution using database table joins provided, but I 
just *knew* this could be solved with looping.

Of course it could be hard coded:
cfoutput
  cfloop from=0 to=1 index=a1
cfloop from=0 to=1 index=a2
  !--- loops for a3 to a21 ---
cfloop from=0 to=1 index=a22
#yesNoFormat(a1)# #yesNoFormat(a2)# !--- output for a3 to 
a21 --- #yesNoFormat(a22)#br
/cfloop
  /cfloop
!--- loop closes for a3 to a21 ---
  /cfloop
/cfoutput

But that was too much work and this should have been solvable with 
iteration.  It took me a couple of days to scrape together a few free 
minutes to come up with this:

cffunction name=it output=yes
  cfargument name=depth type=numeric required=yes
  cfargument name=answerKey type=string required=no default=

cfset var i = 0
  cfif depth-- GT 0
cfloop from=0 to=1 index=i
  #it(depth,answerKey  ' '   yesNoFormat(i))#
/cfloop
  cfelse
  #answerKey#br/
  /cfif
/cffunction

cfoutput#it(22)#/cfoutput

I leave it to somebody else to run the code to generate the 4,194,304 
combinations, but it works well up to 10 'questions'.

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328664
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-25 Thread Thane Sherrington

At 10:57 AM 25/11/2009, Ian Skinner wrote:

So, this problem has been sitting in my kitchen.  The math has been
proved and a good solution using database table joins provided, but I
just *knew* this could be solved with looping.

Of course it could be hard coded:
cfoutput
   cfloop from=0 to=1 index=a1
 cfloop from=0 to=1 index=a2
   !--- loops for a3 to a21 ---
 cfloop from=0 to=1 index=a22
 #yesNoFormat(a1)# #yesNoFormat(a2)# !--- output for a3 to
a21 --- #yesNoFormat(a22)#br
 /cfloop
   /cfloop
 !--- loop closes for a3 to a21 ---
   /cfloop
/cfoutput

But that was too much work and this should have been solvable with
iteration.  It took me a couple of days to scrape together a few free
minutes to come up with this:

cffunction name=it output=yes
   cfargument name=depth type=numeric required=yes
   cfargument name=answerKey type=string required=no default=

 cfset var i = 0
   cfif depth-- GT 0
 cfloop from=0 to=1 index=i
   #it(depth,answerKey  ' '   yesNoFormat(i))#
 /cfloop
   cfelse
   #answerKey#br/
   /cfif
/cffunction

cfoutput#it(22)#/cfoutput

I leave it to somebody else to run the code to generate the 4,194,304
combinations, but it works well up to 10 'questions'.



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328671
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-25 Thread Thane Sherrington

At 10:57 AM 25/11/2009, Ian Skinner wrote:


cffunction name=it output=yes
   cfargument name=depth type=numeric required=yes
   cfargument name=answerKey type=string required=no default=

 cfset var i = 0
   cfif depth-- GT 0
 cfloop from=0 to=1 index=i
   #it(depth,answerKey  ' '   yesNoFormat(i))#
 /cfloop
   cfelse
   #answerKey#br/
   /cfif
/cffunction

cfoutput#it(22)#/cfoutput

I leave it to somebody else to run the code to generate the 4,194,304
combinations, but it works well up to 10 'questions'.

Awesome.  I think I'll generate 10 questions and then ask if he wants 
to take it all the way up to 22.  Thanks for doing that.

T 



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328672
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Working out yes/no possibilities

2009-11-25 Thread brad

Heh, I was wondering if someone would suggest that.  I don't know why I
think the 1 = 1 syntax looks cooler.  I think it's because that is
something you never get to write in actual code without it being wrong
so I get to feel a little naughty doing it!  :)

~Brad

 Original Message 
Subject: Re: Working out yes/no possibilities
From: Leigh _ cfsearch...@yahoo.com
Date: Wed, November 25, 2009 6:09 am
To: cf-talk cf-talk@houseoffusion.com


INNER JOIN @question q2 ON 1 = 1

{Psst ... Cross join} ;-) 



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328676
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Working out yes/no possibilities

2009-11-25 Thread brad

Heh, good job Ian. Now, we need someone to step up and solve it with
recursion.  :)

After that, someone can show us the line of jQuery code used to
accomplish it.  I'm sure there's a plug-in out there...  :)

~Brad

 Original Message 
Subject: Re: Working out yes/no possibilities
From: Ian Skinner h...@ilsweb.com
Date: Wed, November 25, 2009 8:57 am
To: cf-talk cf-talk@houseoffusion.com


So, this problem has been sitting in my kitchen. The math has been 
proved and a good solution using database table joins provided, but I 
just *knew* this could be solved with looping.



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328677
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-25 Thread Ian Skinner

b...@bradwood.com wrote:
 Heh, good job Ian. Now, we need someone to step up and solve it with
 recursion.  :)

I thought I was using recursion?

cfloop from=0 to=1 index=i
 #it(depth,answerKey  ' '   yesNoFormat(i))# !--- recursive call to this 
function ---
/cfloop

Or do I have the wrong idea about recursion?

On the other hand, sorry no JQuery solution here.





~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328679
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Working out yes/no possibilities

2009-11-25 Thread brad

Opps, I'm sorry Ian.  That was, in fact, a recursive solution. That's
what I get for shooting off an E-mail while walking out the door and not
looking at your code close enough.  :)

~Brad


 Original Message 
Subject: Re: Working out yes/no possibilities
From: Ian Skinner h...@ilsweb.com
Date: Wed, November 25, 2009 11:23 am
To: cf-talk cf-talk@houseoffusion.com


b...@bradwood.com wrote:
 Heh, good job Ian. Now, we need someone to step up and solve it with
 recursion. :)

I thought I was using recursion?



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328680
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Working out yes/no possibilities

2009-11-24 Thread Thane Sherrington

At 12:18 AM 24/11/2009, b...@bradwood.com wrote:


So, one possible output for example would be 1010101010101010101010
where each odd numbered question was marked true, and each even numbered
question was marked false.

It may take a while to churn out all 4 million combinations, but it will
work.

May I ask why on earth you are doing this?  :)

Thanks for this Brad, I'll give it a shot.  As to the why, my boss 
wants us to generate every possible answer in the questionnaire for 
testing purposes - I know that makes no sense at all, but mine is not 
to wonder why, mine is but to do and die and all that. :)

T 



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328642
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Working out yes/no possibilities

2009-11-24 Thread brad

May I ask why on earth you are doing this? :)

Thanks for this Brad, I'll give it a shot. As to the why, my boss 
wants us to generate every possible answer in the questionnaire for 
testing purposes - I know that makes no sense at all, but mine is not 
to wonder why, mine is but to do and die and all that. :)

T 


HAHAHAHAHAHAHAHAHAHAHAHAHAHAHA!

Sorry, did I just say that out loud.  *snicker*.  You should ask you
boss how may possible combinations he thinks a test of 22 questions can
have.  I'd LOVE to hear how good his math skills are.  Here's a thought,
perhaps he simple wanted you to take the test TWICE.  Once with all true
and once with all false.  Then you would have hit every possible
answer-- just not in every possible combination.  If at all possible,
can you grab a pic of his face on your camera phone when you tell him
there are over 4 million ways to take your test.  Just wait, in a couple
months he'll be wanting you to test the 50 question multiple choice
quiz.  Not to worry, there's only
1,267,650,600,228,229,401,496,703,205,376 possible ways to take that
one.  You'll have it done in no time.

~Brad
*Sorry, I just had to have some fun with this one*


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328643
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-24 Thread Robert Bell

Ahh, me knee-jerk reactions is that he is looking for
cheating patterns ??

May I ask why on earth you are doing this? :)

Thanks for this Brad, I'll give it a shot. As to the why, my boss 
wants us to generate every possible answer in the questionnaire for 
testing purposes - I know that makes no sense at all, but mine is not 
to wonder why, mine is but to do and die and all that. :)

T 


HAHAHAHAHAHAHAHAHAHAHAHAHAHAHA!

Sorry, did I just say that out loud.  *snicker*.  You should ask you
boss how may possible combinations he thinks a test of 22 questions can
have.  I'd LOVE to hear how good his math skills are.  Here's a thought,
perhaps he simple wanted you to take the test TWICE.  Once with all true
and once with all false.  Then you would have hit every possible
answer-- just not in every possible combination.  If at all possible,
can you grab a pic of his face on your camera phone when you tell him
there are over 4 million ways to take your test.  Just wait, in a couple
months he'll be wanting you to test the 50 question multiple choice
quiz.  Not to worry, there's only
1,267,650,600,228,229,401,496,703,205,376 possible ways to take that
one.  You'll have it done in no time.

~Brad
*Sorry, I just had to have some fun with this one* 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328646
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Working out yes/no possibilities

2009-11-24 Thread Thane Sherrington

At 12:15 PM 24/11/2009, b...@bradwood.com wrote:

HAHAHAHAHAHAHAHAHAHAHAHAHAHAHA!

Sorry, did I just say that out loud.  *snicker*.  You should ask you
boss how may possible combinations he thinks a test of 22 questions can
have.  I'd LOVE to hear how good his math skills are.  Here's a thought,
perhaps he simple wanted you to take the test TWICE.  Once with all true
and once with all false.  Then you would have hit every possible
answer-- just not in every possible combination.  If at all possible,
can you grab a pic of his face on your camera phone when you tell him
there are over 4 million ways to take your test.  Just wait, in a couple
months he'll be wanting you to test the 50 question multiple choice
quiz.  Not to worry, there's only
1,267,650,600,228,229,401,496,703,205,376 possible ways to take that
one.  You'll have it done in no time.

~Brad
*Sorry, I just had to have some fun with this one*

LOL!  You're absolutely right.  I feel like I'm in the middle of a 
dotcom startup. :)  During those times, I know a guy who's job was to 
keep all the clocks in the place (and they had a bunch for different 
timezones) accurate to the second.  Not that the company actually 
needed to have that sort of accuracy, but the boss thought it was a cool idea.

T 



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328649
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-24 Thread Judah McAuley

Make sure you have a simple page with the task labeled on it and then
a big fat Print button. I'd be curious to see how much paper it takes
to print out those 4 million combinations.

Judah

On Tue, Nov 24, 2009 at 2:31 PM, Thane Sherrington
th...@computerconnectionltd.com wrote:

 At 12:15 PM 24/11/2009, b...@bradwood.com wrote:

HAHAHAHAHAHAHAHAHAHAHAHAHAHAHA!

Sorry, did I just say that out loud.  *snicker*.  You should ask you
boss how may possible combinations he thinks a test of 22 questions can
have.  I'd LOVE to hear how good his math skills are.  Here's a thought,
perhaps he simple wanted you to take the test TWICE.  Once with all true
and once with all false.  Then you would have hit every possible
answer-- just not in every possible combination.  If at all possible,
can you grab a pic of his face on your camera phone when you tell him
there are over 4 million ways to take your test.  Just wait, in a couple
months he'll be wanting you to test the 50 question multiple choice
quiz.  Not to worry, there's only
1,267,650,600,228,229,401,496,703,205,376 possible ways to take that
one.  You'll have it done in no time.

~Brad
*Sorry, I just had to have some fun with this one*

 LOL!  You're absolutely right.  I feel like I'm in the middle of a
 dotcom startup. :)  During those times, I know a guy who's job was to
 keep all the clocks in the place (and they had a bunch for different
 timezones) accurate to the second.  Not that the company actually
 needed to have that sort of accuracy, but the boss thought it was a cool idea.

 T



 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328650
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-24 Thread Gerald Guido


 I feel like I'm in the middle of a
 dotcom startup. :)  During those times, I know a guy who's job was to
 keep all the clocks in the place (and they had a bunch for different
 timezones) accurate to the second.  Not that the company actually
 needed to have that sort of accuracy, but the boss thought it was a cool
 idea.


Now, that is an excellent use of resources. Dilbert indeed lives. Sounds to
me more like they might need someone to keep things from blinking 12:00.

At one place I worked 12 o'clock blinker was a code word for the, how
would you say... the technologically challenged. As in, everything in the
place was blinking twelve o'clock

G!



On Tue, Nov 24, 2009 at 5:31 PM, Thane Sherrington 
th...@computerconnectionltd.com wrote:


 At 12:15 PM 24/11/2009, b...@bradwood.com wrote:


-- 
Gerald Guido
http://www.myinternetisbroken.com

Wait. We can't stop here. This is bat country.
-- HST


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328651
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-23 Thread Phillip Vector

Well, the 23rd position of binary is the total number of answers. :)

But if you are looking for a way to store it, why not just a string of
22 characters?

On Mon, Nov 23, 2009 at 5:19 PM, Thane Sherrington
th...@computerconnectionltd.com wrote:

 I have a yes/no questionnaire that I want to fill out with every
 possible pattern of answers - there are 22 questions in total, and
 I'm trying to come up with an algorithm that will give me every
 pattern of answers, but I'm just not bright enough to do it. :)  Can
 anyone point me in the right direction?

 Thanks,

 T



 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328635
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-23 Thread Thane Sherrington

I'd like to get the pattern of answers for each possible pattern (so 
to make this simpler, let's assume there are only 3 questions) I'd 
like to figure out an algorithm that will generate:

YYY
NYY
NNY
NNN
YNN
YYN
YNY
NYN
etc.


T
At 09:32 PM 23/11/2009, Phillip Vector wrote:

Well, the 23rd position of binary is the total number of answers. :)

But if you are looking for a way to store it, why not just a string of
22 characters?

On Mon, Nov 23, 2009 at 5:19 PM, Thane Sherrington
th...@computerconnectionltd.com wrote:
 
  I have a yes/no questionnaire that I want to fill out with every
  possible pattern of answers - there are 22 questions in total, and
  I'm trying to come up with an algorithm that will give me every
  pattern of answers, but I'm just not bright enough to do it. :)  Can
  anyone point me in the right direction?
 
  Thanks,
 
  T
 
 
 
 



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328636
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-23 Thread Ian Skinner

A couple of loops.

cfoutput
cfloop from=1 to=22 index=i
Itteration = #i#
cfloop from=0 to=1 index=x
#yesOrNoFormat(x)#
/cfloop
br/
/cfloop
/cfoutput


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328637
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-23 Thread Ian Skinner

On 11/23/2009 6:51 PM, Ian Skinner wrote:
 A couple of loops.

 cfoutput
 cfloop from=1 to=22 index=i
 Itteration = #i#
 cfloop from=0 to=1 index=x
 #yesOrNoFormat(x)#
 /cfloop
 br/
 /cfloop
 /cfoutput


Never mind, but I think that is close.



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328638
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Working out yes/no possibilities

2009-11-23 Thread brad

There are 2^22 number of combinations I believe (4,194,304).  One of my
favorite ways of doing this is with SQL.  Create a temp table with 2
records-- yes and no.  Now, join that table to itself 22 times. 
Each join will give you a Cartesian product, or all possible
combinations.

untested, but you get the idea...

DECLARE @question TABLE (answer char(1))
INSERT INTO @question VALUES (0)
INSERT INTO @question VALUES (1)

SELECT q1.answer + q2.answer + q3.answer + q4.answer + q5.answer +
q6.answer + q7.answer + q8.answer + q9.answer ... + q22.answer
FROM @question q1
INNER JOIN @question q2 ON 1 = 1
INNER JOIN @question q3 ON 1 = 1
INNER JOIN @question q4 ON 1 = 1
INNER JOIN @question q5 ON 1 = 1
INNER JOIN @question q6 ON 1 = 1
INNER JOIN @question q7 ON 1 = 1
INNER JOIN @question q8 ON 1 = 1
INNER JOIN @question q9 ON 1 = 1

INNER JOIN @question q22 ON 1 = 1

So, one possible output for example would be 1010101010101010101010
where each odd numbered question was marked true, and each even numbered
question was marked false.

It may take a while to churn out all 4 million combinations, but it will
work.

May I ask why on earth you are doing this?  :)

~Brad

 Original Message 
Subject: Working out yes/no possibilities
From: Thane Sherrington th...@computerconnectionltd.com
Date: Mon, November 23, 2009 7:19 pm
To: cf-talk cf-talk@houseoffusion.com


I have a yes/no questionnaire that I want to fill out with every 
possible pattern of answers - there are 22 questions in total, and 
I'm trying to come up with an algorithm that will give me every 
pattern of answers, but I'm just not bright enough to do it. :) Can 
anyone point me in the right direction?

Thanks,

T




~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328639
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Working out yes/no possibilities

2009-11-23 Thread brad

FWIW, I ran the code below on a test pc in my home (crappy Celeron) and
it generated all 4.1 million combinations in 8 minutes and 32 seconds. 
I'm pretty certain you could do a little better on server hardware.

~Brad


 Original Message 
Subject: RE: Working out yes/no possibilities
From: b...@bradwood.com
Date: Mon, November 23, 2009 10:18 pm
To: cf-talk cf-talk@houseoffusion.com


There are 2^22 number of combinations I believe (4,194,304). One of my
favorite ways of doing this is with SQL. Create a temp table with 2
records-- yes and no. Now, join that table to itself 22 times. 
Each join will give you a Cartesian product, or all possible
combinations.

untested, but you get the idea...

DECLARE @question TABLE (answer char(1))
INSERT INTO @question VALUES (0)
INSERT INTO @question VALUES (1)

SELECT q1.answer + q2.answer + q3.answer + q4.answer + q5.answer +
q6.answer + q7.answer + q8.answer + q9.answer ... + q22.answer
FROM @question q1
INNER JOIN @question q2 ON 1 = 1
INNER JOIN @question q3 ON 1 = 1
INNER JOIN @question q4 ON 1 = 1
INNER JOIN @question q5 ON 1 = 1
INNER JOIN @question q6 ON 1 = 1
INNER JOIN @question q7 ON 1 = 1
INNER JOIN @question q8 ON 1 = 1
INNER JOIN @question q9 ON 1 = 1

INNER JOIN @question q22 ON 1 = 1



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328640
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Working out yes/no possibilities

2009-11-23 Thread Judah McAuley

I'd recommend hiring monkeys and typewriters personally.

I'm not actually sure which is harder to come by these days.

Of out curiosity, what format do you want these answers in? Do you
want a print out of 4 million combinations? Do you want to do
something else with them? Do you want to figure out something else?

Judah

On Mon, Nov 23, 2009 at 5:19 PM, Thane Sherrington
th...@computerconnectionltd.com wrote:

 I have a yes/no questionnaire that I want to fill out with every
 possible pattern of answers - there are 22 questions in total, and
 I'm trying to come up with an algorithm that will give me every
 pattern of answers, but I'm just not bright enough to do it. :)  Can
 anyone point me in the right direction?

 Thanks,

 T



 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328641
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4