The deal with using 4d arrays :D

• 11-03-2005
Shamino
What not to do with arrays :)
Well I just learned something in the past week, when you have a 4d array, such as

s[3].[3][14][28]

and try to loop it as such

Code:

```for(a; a<3; a++) { for(b; b<3; b++) { for(c; c<14; c++) { for(d; d<28; d++) { s[a].[b][c][d].sold = false } } } }```
Hehe...... yeah, right there is about 10,000 mathematical operations...

Note to all who may be tempted, don't do this :D
• 11-03-2005
skorman00
To be exact

3528 assignments with the array.
3666 ++ operations.
• 11-03-2005
Shamino
considering it takes

column*row+1....... to move through a 2 dimensional matrix.. a 4d one has even more

multiply it by about 3-5 again :)
• 11-03-2005
skorman00
ooo, didn't think about that Shamino. Good call.
• 11-03-2005
Shamino
you can thank Bubba for this bit of knowledge :d
• 11-04-2005
Shamino
my program was doing anywhere between 200,000-400,000 mathematical operations per frame, no wonder it got about 5 fps :\
• 11-04-2005
hdragon
that is for low graphic card or low processor, with high graphic card and high speed processor, these calculations are not big of a deal
• 11-04-2005
Shamino
we have a beastly processor... 2.4 gigahurts, it still runs at 5 or so fps...

oddly enough, at home my p3 dual 400 mhz runs its perfectly smooth, strange..
• 11-04-2005
The Brain
i think the more important question is.. who the heck needs a 4 dimensional array..?!?
• 11-05-2005
VirtualAce
Quote:

that is for low graphic card or low processor, with high graphic
card and high speed processor, these calculations are not big of a deal
You are wrong.

Wasting cycles is still wasting cycles even on a super-computer. And so far you haven't shown me any code that is being processed by the graphics card so it has no relevance as of yet.

And if it is not a big deal, then why is your code running so slow?