[wplug] OT - programming logic help

Chris Romano romano.chris at gmail.com
Thu Apr 23 10:58:19 EDT 2009


I'm trying to work through this and for some reason I just can't
figure it out.  Lets see if I can explain this properly.

I guess you can say that I'm working with fractals.  Say that I have 4
values and I would to loop through all possible combination of those 4
variables where the order is important.  That total number is 4! or
24.

I'm coding this in php but any kind of pseudo code will work.  The
number data points isn't static at 4, it will actually be between 5
and 9, but 4 is an easier number to work with.

Here are all the possible combos ... (it's easy to do on paper, just
can't figure how to do this with code).

1	2	3	4
1	2	4	3
1	3	2	4
1	3	4	2
1	4	2	3
1	4	3	2
2	1	3	4
2	1	4	3
2	3	1	4
2	3	4	1
2	4	1	3
2	4	3	1
3	1	2	4
3	1	4	2
3	2	1	4
3	2	4	1
3	4	1	2
3	4	2	1
4	1	2	3
4	1	3	2
4	2	1	3
4	2	3	1
4	3	1	2
4	3	2	1


Any help would be greatly appreciated,

Chris

-- 
"They that would trade essential liberty for a little temporary safety
deserve neither." -- Benjamin Franklin


More information about the wplug mailing list