Click to See Complete Forum and Search --> : How many combinations??
TheBoy
Apr 18th, 2005, 03:33 PM
Hi there. I need some help here because I am not all that clued up on maths. I have a 3d array, 4x4x4, totalling 64 cells. Now I need to know how many possible combinations there are too have 4 cells in a row, imagine in a connect 4 style. I have done it on paper and reckon there are 64 different combinations. Now if this is correct then I need to a formula to work out how many there are, a general formula so if the grid size was changed then it would still work.
Many thanks
kedaman
Apr 19th, 2005, 02:13 AM
case study:
along x axis: yz(x-3) or 0 if x<4
along y axis: xz(y-3) or 0 if y<4
along z axis: xy(z-3) or 0 if z<4
diagonally along xy plane: 2*z(x-3)(y-3) or 0 if x<4 and y<4
diagonally along yz plane: 2*x(z-3)(y-3) or 0 if z<4 and y<4
diagonally along xz plane: 2*y(x-3)(z-3) or 0 if x<4 and z<4
diagonally across space: 4*(y-3)(x-3)(z-3) or 0 if x<4 and z<4 and y<4
then sum them up.
edit: btw there should be 76 ways of having 4 in a row in 4x4x4 space
Guv
Apr 20th, 2005, 01:16 PM
Why not 48 + 4 = 52?
There are 16 sets of cells parallel to each of the xyz-axes: 3 * 16 = 48
There are 4 diagonals: 48 + 4 = 52
kedaman
Apr 20th, 2005, 11:49 PM
there are also 8 diagonals along each plane, adding another 24
Guv
Apr 21st, 2005, 09:40 AM
Kedaman: Right you are!!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.