Forum Moderators: coopster

Message Too Old, No Replies

problem with seting outcome based on combination

Best way?

         

Sarah Atkinson

3:37 pm on Aug 10, 2005 (gmt 0)

10+ Year Member



I have 3 things A, B, and C I've come up with 7 different combinations AB&C can be combined
A
B
C
AB
AC
BC
ABC

in my code AB&C are all stored in seperate variables and I want to change a forth varriable based on which combo of ABC exsists. Do I just have to have 7 if statments that have 3 things with && or is there away to use a case statment? Or is there another easier way?

Also isn't there a mathmatical term for these kind of problem? or the graph used with it? anyone know what it is?

coopster

2:47 am on Aug 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm no mathematics professional but if I understand you correctly there are actually 64 different combinations there. There are three positions and each position could be occupied by one of four characters -- ' ', 'A', 'B', or 'C'. Therefore,
4x4x4 = 64

We need one of our mathematics experts here to correct me if I'm wrong.

Regarding the term you may be referring to -- it may be what is known as bitwise operations, but you are already pushing the boundaries for most operating systems at 64. 32 might be safe, but 64 is pushing things.

jatar_k

2:53 am on Aug 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



i see what you are getting at coop

Sarah would AB and BA be the same thing?

Sarah Atkinson

2:58 pm on Aug 12, 2005 (gmt 0)

10+ Year Member



yes AB and BA would be the same thing.

I did get mine to work yesterday by sticking them into an array then bringing them back out into a sting and then inserting the sting into the database. it wasn't what I had in mind but simpler and it worked so I guess that is all that maters.

There are two different type of combination things like these
one more like a combination lock or slot machine.

the kind like mine which is like this problem:
There are 5 people;Bill, Jane,Sue,Tom,and David. They have 2 cars each seating 5 people. How many different groups are possible for 1 car.

Btw anyone here love mindbbenders as a kid? I use to have a book of them where youd have problems and like having to match person with their color bike and it would give you clues to deduce which bike went with what person?

Probably the most famoue one of these would be the one J.K. Rowling did in Harry Potter.

jatar_k

3:14 pm on Aug 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> love mindbbenders as a kid

yep, loved them, must be a programmer trait ;)

glad you figured something out

Sarah Atkinson

5:09 pm on Aug 12, 2005 (gmt 0)

10+ Year Member



yep, loved them, must be a programmer trait ;)

True both require the use of logic. although I've seen a few illogical bytes of code here and there that I wandered if their programer could think his way out of a cardbord box.

jatar_k

5:35 pm on Aug 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> I've seen a few illogical bytes of code here and there

you really have to ignore most of my posts ;)