LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Getting the Dimension Lengths from 2D Arrays

Root / General / [.]

HackTheWorldsCreated:
So I figured out how to determine the length of dimensions in 2D arrays. I don't want to explain how it works right now, so I'll just give you the key: E245W8V I also learned that you can COPY between arrays with fewer or lesser dimensions as long as there are enough total elements, which is strange.

broken key

Fixed.

I don't want to explain how it works right now
Well, I do. FILL, in the built-in help, is shown as FILL Array, Value [, Offset [, Number of elements]]. 'Offset' is a single number. In a 1D array, it corresponds exactly to the index. In a 2D array, it corresponds to (second index + (second dimension size)*(first index)). For 3D, (third index + (third dimension size)*(second index + (second dimension size)*(first index))). For 4D, the pattern continues. So, the program uses COPY to copy the array in question to a placeholder array. The placeholder array's elements are FILLed with their own 'offset' value. Then, array index [1,0] contains the size of the second dimension, the number of times this fits into the LEN of the array is the size of the first dimension. The code assumes the size of the first dimension is at least 2. It can be adapted for 3D, 4D arrays, but there is no way (so far as I know) to know, given just an array, how many dimensions it has.

I see how you put
FILL A%, 42
They always said 42 was the answer to the universe. Anyways, this is AWESOME