## Position item in an array larger than 3D

General FreeBASIC programming questions.
fxm
Posts: 10263
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

### Re: Position item in an array larger than 3D

lrcvs wrote:Always read first rows (a), after columns (b) and then levels (c) and finally the dimensions (d).
My formula or method and example are correct.!
It is your method but FreeBASIC does not work as that.
Extract of documentation about DIM
Multidimensional arrays ... are stored in this definite order: values differing only in the last index are contiguous (row-major order).

Compare the result of your formula/method relating to the array memory mapping by the FreeBASIC compiler.
Your result is not coherent with the FreeBASIC code execution, mine yes!

Code: Select all

`Dim As Integer array(1 To 3, 1 To 3, 1 To 3, 1 To 3)Print @array(3, 1, 3, 3) - @array(1, 1, 1, 1)Sleep`

Code: Select all

`62`
fxm
Posts: 10263
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

### Re: Position item in an array larger than 3D

Mapping of 'Dim As Integer array(1 To 3, 1 To 3, 1 To 3, 1 To 3)' in memory.
The value of each element is initialized to the number corresponding to the concatenation of its 4 indexes (in decimal base).

Code: Select all

`Dim As Integer array(1 To 3, 1 To 3, 1 To 3, 1 To 3)Dim As Integer Ptr p = @array(1, 1, 1, 1)For I As Integer = 1 To 3  For J As Integer = 1 To 3    For K As Integer = 1 To 3      For L As Integer = 1 To 3        array(I, J, K, L) = I * 1000 + J * 100 + K * 10 + L      Next L    Next K  Next JNext IFor I As Integer = 0 to 3 * 3 * 3 * 3 - 1  If I Mod 10 = 0 Then    Print  End If  Print p[I];Next IPrintSleep`

Code: Select all

`1111 1112 1113 1121 1122 1123 1131 1132 1133 12111212 1213 1221 1222 1223 1231 1232 1233 1311 13121313 1321 1322 1323 1331 1332 1333 2111 2112 21132121 2122 2123 2131 2132 2133 2211 2212 2213 22212222 2223 2231 2232 2233 2311 2312 2313 2321 23222323 2331 2332 2333 3111 3112 3113 3121 3122 31233131 3132 3133 3211 3212 3213 3221 3222 3223 32313232 3233 3311 3312 3313 3321 3322 3323 3331 33323333`
81 elements
element '3133' is at position 63 => offset = 62
fxm
Posts: 10263
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

### Re: Position item in an array larger than 3D

Mapping of 'array(1 To 7, 1 To 6, 1 To 5, 1 To 4, 1 To 3)' in memory.
The value of each element is initialized to the number corresponding to the concatenation of its 5 indexes (in decimal base).

Code: Select all

`Dim As Integer array(1 To 7, 1 To 6, 1 To 5, 1 To 4, 1 To 3)Dim As Integer Ptr p = @array(1, 1, 1, 1, 1)For I As Integer = 1 To 7  For J As Integer = 1 To 6    For K As Integer = 1 To 5      For L As Integer = 1 To 4        For M As Integer = 1 To 3          array(I, J, K, L, M) = I * 10000 + J * 1000 + K * 100 + L * 10 + M        Next M      Next L    Next K  Next JNext IFor I As Integer = 0 to 7 * 6 * 5 * 4 * 3 - 1  If I mod 10 = 0 Then    If I Mod 200 = 0 and I > 0 Then      Print      Print "Any key to continue..."      Sleep    End If    Print    Print Using "(####)"; I;  End If  Print p[I];Next IPrintPrint "End"Sleep`

Code: Select all

`(1990) 64142 64143 64211 64212 64213 64221 64222 64223 64231 64232Any key to continue...(2000) 64233 64241 64242 64243 64311 64312 64313 64321 64322 64323(2010) 64331 64332 64333 64341 64342 64343 64411 64412 64413 64421(2020) 64422 64423 64431 64432 64433 64441 64442 64443 64511 64512(2030) 64513 64521 64522 64523 64531 64532 64533 64541 64542 64543(2040) 65111 65112 65113 65121 65122 65123 65131 65132 65133 65141(2050) 65142 65143 65211 65212 65213 65221 65222 65223 65231 65232(2060) 65233 65241 65242 65243 65311 65312 65313 65321 65322 65323(2070) 65331 65332 65333 65341 65342 65343 65411 65412 65413 65421(2080) 65422 65423 65431 65432 65433 65441 65442 65443 65511 65512(2090) 65513 65521 65522 65523 65531 65532 65533 65541 65542 65543(2100) 66111 66112 66113 66121 66122 66123 66131 66132 66133 66141(2110) 66142 66143 66211 66212 66213 66221 66222 66223 66231 66232(2120) 66233 66241 66242 66243 66311 66312 66313 66321 66322 66323(2130) 66331 66332 66333 66341 66342 66343 66411 66412 66413 66421(2140) 66422 66423 66431 66432 66433 66441 66442 66443 66511 66512(2150) 66513 66521 66522 66523 66531 66532 66533 66541 66542 66543(2160) 71111 71112 71113 71121 71122 71123 71131 71132 71133 71141(2170) 71142 71143 71211 71212 71213 71221 71222 71223 71231 71232(2180) 71233 71241 71242 71243 71311 71312 71313 71321 71322 71323(2190) 71331 71332 71333 71341 71342 71343 71411 71412 71413 71421Any key to continue...`
We can verify that element '65432' is at offset 2083
dodicat
Posts: 6885
Joined: Jan 10, 2006 20:30
Location: Scotland

### Re: Position item in an array larger than 3D

Not withstanding bloomers and in lieu of everything, you now have another formula Ircvs.

Code: Select all

` #define offset(array,position,from,lowerbounds) @array position -@array lowerboundsDim As Integer array(1 To 3, 1 To 3, 1 To 3, 1 To 3)print offset(array,(3,1,3,3),from,(1,1,1,1))sleep `

Also, I prefer to visualize array dimensions as a homing in process.
Eventually, like a function, returning one value.
assign the value in the inner loop.
EXAMPLE:
array(earth,boisphere,anamalia,mammalia,rodentia,muriodea,murinae,mus,house mouse) = cheese.
lrcvs
Posts: 576
Joined: Mar 06, 2008 19:27
Location: Spain

### Re: Position item in an array larger than 3D

Friends, here my program and formula
:::::::::::::::::::::::::::::::::::::::::::::::

Code: Select all

`Dim As Integer a,b,c,d,j,k,l,m,n,p,r,s,t,u, xCls'create array 4Dj = 3k = 3l = 3m = 3Dim w (j,k,l,m) As Integer'create array 1DDim v (3*3*3*3) As Integer'position to look of "X"a = 3b = 1c = 3d = 3p = 0For r = 1 To j   For s = 1 To k      For t = 1 To l         For u = 1 To m            p = p + 1         w (r,s,t,u) = p 'into W 4D array         v (p) = p ' into v 1D array                  Next      Next   NextNext'here show the item "x" to lookp = 1For r = 1 To j   For s = 1 To k      For t = 1 To l         For u = 1 To m           If r = d  And s = c And t = a And u = b Then Print "Position 4D = ";w (d,c,a,u)          p = p + 1            Next u      Next t   Next sNext r' calculate position with formula (((a - 1) * c) + ((f * c) * (c - 1)) + b) + ((j*k*l) *(m - 1))x = (((a - 1) * k) + ((j * k) * (c - 1)) + b) + ((j*k*l)*(m - 1))Print "Position of X with formula = ";xPrint "Position 1D = ";v (x)SleepEnd`

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Image in Screen

Position 4D = 79
Position of X with formula = 79
Position 1D = 79
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Greetings
dodicat
Posts: 6885
Joined: Jan 10, 2006 20:30
Location: Scotland

### Re: Position item in an array larger than 3D

Your formula is nearly correct, but I've corrected it.
Also, position4d is surely 3,1,3,3.
So I've made it that.
Also you must include p at value 0, so I've started to increment p AFTER it has passed through 0.
Also, to be strictly correct, w should be 1 to 3, not 0 to 3, but I've left that as 0 is not included in the loops.
I've changed c to b in your formula and added 1 to compensate for the altered p increment.

Code: Select all

`Dim As Integer a,b,c,d,j,k,l,m,n,p,r,s,t,u, xCls'create array 4Dj = 3k = 3l = 3m = 3Dim w (j,k,l,m) As Integer'create array 1DDim v (3*3*3*3) As Integer'position to look of "X"a = 3b = 1c = 3d = 3p = 0For r = 1 To jFor s = 1 To kFor t = 1 To lFor u = 1 To m'p = p + 1w (r,s,t,u) = p 'into W 4D arrayv (p) = p ' into v 1D array p=p+1NextNextNextNext'here show the item "x" to lookp = 1For r = 1 To jFor s = 1 To kFor t = 1 To lFor u = 1 To mIf r = a And s = b And t = c And u = d Then Print "Position 4D = ";w (r,s,t,u) p = p + 1 Next uNext tNext sNext r' calculate position with formula (((a - 1) * c) + ((f * c) * (c - 1)) + b) + ((j*k*l) *(m - 1))x = (((a - 1) * k) + ((j * k) * (b - 1)) + b) + ((j*k*l)*(m - 1))+1Print "Position of X with formula = ";xPrint "Position 1D = ";v (x)SleepEnd'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'Image in Screen'Position 4D = 62'Position of X with formula = 62'Position 1D = 62:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::  `
fxm
Posts: 10263
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

### Re: Position item in an array larger than 3D

Yes, but I thought that the aim of this topic was to take as exact model the FreeBASIC compiler mapping in memory for multidimensional array!
Your model is other (indexes not taken in the same order for memory mapping).

Modifying 2 lines in your program, we recover the FreeBASIC compiler mapping:

Code: Select all

`Dim As Integer a,b,c,d,j,k,l,m,n,p,r,s,t,u, xCls'create array 4Dj = 3k = 3l = 3m = 3Dim w (j,k,l,m) As Integer'create array 1DDim v (3*3*3*3) As Integer'position to look of "X"a = 3b = 1c = 3d = 3p = 0For r = 1 To jFor s = 1 To kFor t = 1 To lFor u = 1 To mp = p + 1w (r,s,t,u) = p 'into W 4D arrayv (p) = p ' into v 1D arrayNextNextNextNext'here show the item "x" to lookp = 1For r = 1 To jFor s = 1 To kFor t = 1 To lFor u = 1 To m'If r = d And s = c And t = a And u = b Then Print "Position 4D = ";w (d,c,a,u)If r = a And s = b And t = c And u = d Then Print "Position 4D = ";w (r,s,t,u) 'compatibility with FreeBASIC compilerp = p + 1Next uNext tNext sNext r' calculate position with formula (((a - 1) * c) + ((f * c) * (c - 1)) + b) + ((j*k*l) *(m - 1))'x = (((a - 1) * k) + ((j * k) * (c - 1)) + b) + ((j*k*l)*(m - 1))x = (((c - 1) * k) + ((j * k) * (b - 1)) + d) + ((a - 1)*(k*l*m)) 'compatibility with FreeBASIC compilerPrint "Position of X with formula = ";xPrint "Position 1D = ";v (x)SleepEnd`
You toke the order d, c, a, b
when FreeBASIC compiler takes the order a, b, c, d

Remark:
It would more beautiful to write the formula with this terms order + error typo:
' calculate position with formula (((f * c) * (c - 1)) + (c * (a - 1)) + b) + ((j*k*l) *(m - 1))
'x = (((j * k) * (c - 1)) + (k * (a - 1)) + b) + ((j*k*l)*(d - 1))
x = (((j * k) * (b - 1)) + (k * (c - 1)) + d) + ((a - 1)*(k*l*m)) 'compatibility with FreeBASIC compiler

{Edit]
Correction of typo in the last formula.
Last edited by fxm on May 06, 2012 5:04, edited 2 times in total.
dodicat
Posts: 6885
Joined: Jan 10, 2006 20:30
Location: Scotland

### Re: Position item in an array larger than 3D

I't getting late now.
I assume that the freebasic mapping is from 0 to total number of elements-1, as used by the array pointer.
If it is then here would be my formula.

Code: Select all

`dim as integer n,o,p,qn=1o=1p=1q=1dim as integer j,k,l,mj=3k=3l=3m=3dim as integer a,b,c,da=3b=1c=3d=3dim as integer array(n To j, o To k, p To l, q To m)dim as integer X= (m-q+1)*((l-p+1)*((k-o+1)*(a-n)+(b-o))+(c-p))+(d-q)print Xsleep  `

If not, then as I said, it's getting late.
lrcvs
Posts: 576
Joined: Mar 06, 2008 19:27
Location: Spain

### Re: Position item in an array larger than 3D

Well, now there are multiple questions:

So that applications can use?

As a mathematical function, you can apply to any programming language and mathematical, for doing so, make it known!

The first advantage I see is that with this formula / method, we save our beloved loops "For / next", "do / until", "while / do" ...., in any process where we have to find an element within an array.

Second advantage is time saved in the process of searching for an element in any array, then make a function that works directly with this mathematical process.!

As noted, a humble seed (question) can be born a great tree (applications).

Now you, are the technicians / specialists, develop it and make it known, for without your help this would not have been possible.!

My knowledge is very limited in this field.!

You can call it formula / method "XKrouhn" is one of my alias on the network.

Now I retire to continue experimenting / playing with new ideas.

Notify what ye do.!

Greetings from Spain.

My sentence: "Here a friend"
fxm
Posts: 10263
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

### Re: Position item in an array larger than 3D

I remind you my two mathematical functions (compatible with FreeBASIC) already mentioned in a previous post:

For 4D array
Dim Shared As Integer U4,L4,U3,L3,U2,L2,U1,L1 'dim array(L4 To U4,L3 To U3,L2 To U2,L1 To U1)
Dim Shared As Integer N4,N3,N2,N1 'array(N4,N3,N2,N1)

Function offset4() As Integer
Return (((N4-L4)*(U3-L3+1)+N3-L3)*(U2-L2+1)+N2-L2)*(U1-L1+1)+N1-L1
End Function

For 5D array
Dim Shared As Integer U5,L5,U4,L4,U3,L3,U2,L2,U1,L1 'dim array(L5 To U5,L4 To U4,L3 To U3,L2 To U2,L1 To U1)
Dim Shared As Integer N5,N4,N3,N2,N1 'array(N5,N4,N3,N2,N1)

Function offset5() As Integer
Return ((((N5-L5)*(U4-L4+1)+N4-L4)*(U3-L3+1)+N3-L3)*(U2-L2+1)+N2-L2)*(U1-L1+1)+N1-L1
End Function
fxm
Posts: 10263
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

### Re: Position item in an array larger than 3D

Then the next mathematical function for 6D array (always compatibility verified with FreeBASIC)
Dim Shared As Integer U6,L6,U5,L5,U4,L4,U3,L3,U2,L2,U1,L1 'dim array(L6 To U6,L5 To U5,L4 To U4,L3 To U3,L2 To U2,L1 To U1)
Dim Shared As Integer N6,N5,N4,N3,N2,N1 'array(N6,N5,N4,N3,N2,N1)

Function offset6() As Integer
Return (((((N6-L6)*(U5-L5+1)+N5-L5)*(U4-L4+1)+N4-L4)*(U3-L3+1)+N3-L3)*(U2-L2+1)+N2-L2)*(U1-L1+1)+N1-L1
End Function
'verified with: @array(N6,N5,N4,N3,N2,N1)-@array(L6,L5,L4,L3,L2,L1)

At the end, the mathematical function for 7D array (always compatibility verified with FreeBASIC)
Dim Shared As Integer U7,L7,U6,L6,U5,L5,U4,L4,U3,L3,U2,L2,U1,L1 'dim array(L7 To U7,L6 To U6,L5 To U5,L4 To U4,L3 To U3,L2 To U2,L1 To U1)
Dim Shared As Integer N7,N6,N5,N4,N3,N2,N1 'array(N7,N6,N5,N4,N3,N2,N1)

Function offset7() As Integer
Return ((((((N7-L7)*(U6-L6+1)+N6-L6)*(U5-L5+1)+N5-L5)*(U4-L4+1)+N4-L4)*(U3-L3+1)+N3-L3)*(U2-L2+1)+N2-L2)*(U1-L1+1)+N1-L1
End Function
'verified with: @array(N7,N6,N5,N4,N3,N2,N1)-@array(L7,L6,L5,L4,L3,L2,L1)

and so on...
Richard
Posts: 3072
Joined: Jan 15, 2007 20:44
Location: Australia

### Re: Position item in an array larger than 3D

FB uses a faster solution by pre-computing the spans and a lower bound correction that can be combined with the array base address.
This makes the address equation simpler to write, and faster to evaluate.

Code: Select all

`'=======================================================================' Faster and Simpler, this example is for a 4D array'=======================================================================Dim Shared As Integer L4=1, L3=2, L2=1, L1=0    ' lower boundsDim Shared As Integer u4=2, u3=3, u2=2, u1=1    ' upper boundsDim Shared As Integer s4, s3, s2, s1 ' dimension spans, sn = un - Ln + 1Dim Shared As Integer k = 0 ' lower bounds adjustment, to be precomputed'-----------------------------------------------------------------------' this is the simpler and easily expanded position equationFunction dim_4(_    Byval i4 As Integer, Byval i3 As Integer,_    Byval i2 As Integer, Byval i1 As Integer) As Integer    Return ((i4  *s3+i3)  *s2+i2)  *s1+i1  +kEnd Function'-----------------------------------------------------------------------' precompute once the array descriptor parameters s4 = u4 - L4 + 1s3 = u3 - L3 + 1s2 = u2 - L2 + 1s1 = u1 - L1 + 1k = - dim_4( L4, L3, L2, L1 )Print "k ="; k'-----------------------------------------------------------------------' test the codeDim As Integer a( L4 To u4, L3 To u3, L2 To u2, L1 To u1 )  ' an arrayDim As Integer i4, i3, i2, i1                   ' array indexesDim As Integer Ptr ba = @a( L4, L3, L2, L1 )    ' base addressPrint "ba ="; baPrintDim As String f = "###  ###  ###  ###   ########   ######## " Print             " i4   i3   i2   i1    FBarray    dim_4() "For i4 = L4 To u4    For i3 = L3 To u3        For i2 = L2 To u2            For i1 = L1 To u1                Print Using f; i4; i3; i2; i1; @a(i4, i3, i2, i1)-ba; dim_4(i4, i3, i2, i1)            Next i1        Next i2    Next i3Next i4'=======================================================================Sleep'=======================================================================`

And here is a trivial equation generator for any number of dimensions...

Code: Select all

`Dim As Integer n, i For n = 1 To 10    Dim As String eqn = "i" + Str(n)    For i = n-1 To 1 Step -1        eqn = "(" + eqn + "*s" + Str(i) + "+i" + Str(i) + ")"    Next i    Print "Return " + eqn + "+k"Next n`

This is the example output...
Return i1+k
Return (i2*s1+i1)+k
Return ((i3*s2+i2)*s1+i1)+k
Return (((i4*s3+i3)*s2+i2)*s1+i1)+k
Return ((((i5*s4+i4)*s3+i3)*s2+i2)*s1+i1)+k
Return (((((i6*s5+i5)*s4+i4)*s3+i3)*s2+i2)*s1+i1)+k
Return ((((((i7*s6+i6)*s5+i5)*s4+i4)*s3+i3)*s2+i2)*s1+i1)+k
Return (((((((i8*s7+i7)*s6+i6)*s5+i5)*s4+i4)*s3+i3)*s2+i2)*s1+i1)+k
Return ((((((((i9*s8+i8)*s7+i7)*s6+i6)*s5+i5)*s4+i4)*s3+i3)*s2+i2)*s1+i1)+k
Return (((((((((i10*s9+i9)*s8+i8)*s7+i7)*s6+i6)*s5+i5)*s4+i4)*s3+i3)*s2+i2)*s1+i1)+k
lrcvs
Posts: 576
Joined: Mar 06, 2008 19:27
Location: Spain

### Re: Position item in an array larger than 3D

Sorry I can not continue with this subject, because as I said in my previous post, "my skills are limited in this field"

Greetings and thanks to all.!!!
fxm
Posts: 10263
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

### Re: Position item in an array larger than 3D

To me also conclude, I applied the improvement method of Richard to my 'Offset formula for your 4D array element and verification' previous code at my post viewtopic.php?p=173831#p173831.

Obviously, I found the same formula.
The variable 'k', that Richard calls 'lower bounds adjustment', represents the offset of the reel or virtual element (0,0,0,0), which is valid or not valid depending on the array bounds.

Code: Select all

`Dim Shared As Integer U4,L4,U3,L3,U2,L2,U1,L1  'dim array(L4 To U4,L3 To U3,L2 To U2,L1 To U1)Dim Shared As Integer N4,N3,N2,N1              'array(N4,N3,N2,N1)Dim Shared As Integer S4,S3,S2,S1              'size of each dimensionDim Shared As Integer K                        'offset of pseudo array(0,0,0,0)Function offset4() As Integer  Return ((N4*S3+N3)*S2+N2)*S1+N1+KEnd FunctionU4 = 3 : L4 = 1U3 = 3 : L3 = 1U2 = 3 : L2 = 1U1 = 3 : L1 = 1N4 = 3N3 = 1N2 = 3N1 = 3S4 = U4-L4+1S3 = U3-L3+1S2 = U2-L2+1S1 = U1-L1+1K = -(((L4*S3+L3)*S2+L2)*S1+L1)Print Offset4()PrintDim As Integer array(L4 To U4,L3 To U3,L2 To U2,L1 To U1)Print "verification"Print @array(N4,N3,N2,N1)-@array(L4,L3,L2,L1)Sleep`
dodicat
Posts: 6885
Joined: Jan 10, 2006 20:30
Location: Scotland

### Re: Position item in an array larger than 3D

I'll conclude also, it has been an interesting topic.
But I'll go out with a blaze, all you guys have been beautifying the final equation, my final macros are all but beautifull maths.
file1
This writes the bas file for the macros up to degree 20:

Code: Select all

`dim as integer dimensions=20open "offset.bas" for output as #1print #1,"#define ub ubound"print #1,"#define lb lbound"print #1,"#define _r(arr,n) (ub(arr,n)-lb(arr,n)+1)"print #1,"#define d1(a,n1) (n1-lb(a,1))"print #1,"#define d2(a,n1,n2) (_r(a,2)*d1(a,n1)+(n2-lb(a,2)))"dim as string temp,params,_r,endbitfor z as integer=3 to dimensions    temp=temp+"n"+str(z)+","    params=str(z)+"(a,n1,n2,"+temp    params=rtrim(params,",")+")"    _r=" (_r(a,"+str(z)+")*d"+str(z-1)+"(a,"    endbit="+(n"+str(z)+"-lb(a,"+str(z)+")))"    print #1,"#define d"+params+_r+mid(params,5,len(params)-8)+")"+endbitnext zclose #1 `

This is an example, the 20 dimensions are in recursive macros, the example is degree 8.
(I get an error of too many dimensions from the compiler if I go higher than eight)

Code: Select all

`#define ub ubound#define lb lbound#define _r(arr,n) (ub(arr,n)-lb(arr,n)+1)#define d1(a,n1) (n1-lb(a,1))#define d2(a,n1,n2) (_r(a,2)*d1(a,n1)+(n2-lb(a,2)))#define d3(a,n1,n2,n3) (_r(a,3)*d2(a,n1,n2)+(n3-lb(a,3)))#define d4(a,n1,n2,n3,n4) (_r(a,4)*d3(a,n1,n2,n3)+(n4-lb(a,4)))#define d5(a,n1,n2,n3,n4,n5) (_r(a,5)*d4(a,n1,n2,n3,n4)+(n5-lb(a,5)))#define d6(a,n1,n2,n3,n4,n5,n6) (_r(a,6)*d5(a,n1,n2,n3,n4,n5)+(n6-lb(a,6)))#define d7(a,n1,n2,n3,n4,n5,n6,n7) (_r(a,7)*d6(a,n1,n2,n3,n4,n5,n6)+(n7-lb(a,7)))#define d8(a,n1,n2,n3,n4,n5,n6,n7,n8) (_r(a,8)*d7(a,n1,n2,n3,n4,n5,n6,n7)+(n8-lb(a,8)))#define d9(a,n1,n2,n3,n4,n5,n6,n7,n8,n9) (_r(a,9)*d8(a,n1,n2,n3,n4,n5,n6,n7,n8)+(n9-lb(a,9)))#define d10(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10) (_r(a,10)*d9(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,)+(n10-lb(a,10)))#define d11(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11) (_r(a,11)*d10(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,)+(n11-lb(a,11)))#define d12(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12) (_r(a,12)*d11(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,)+(n12-lb(a,12)))#define d13(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13) (_r(a,13)*d12(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,)+(n13-lb(a,13)))#define d14(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14) (_r(a,14)*d13(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,)+(n14-lb(a,14)))#define d15(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15) (_r(a,15)*d14(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,)+(n15-lb(a,15)))#define d16(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16) (_r(a,16)*d15(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,)+(n16-lb(a,16)))#define d17(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17) (_r(a,17)*d16(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,)+(n17-lb(a,17)))#define d18(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18) (_r(a,18)*d17(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,)+(n18-lb(a,18)))#define d19(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19) (_r(a,19)*d18(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,)+(n19-lb(a,19)))#define d20(a,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20) (_r(a,20)*d19(a,,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,)+(n20-lb(a,20)))dim shared as byte a(1 to 6,3 to 7,4 to 8,2 to 6,3 to 7,4 to 8,2 to 5,4 to 9)print  d8(a,2,4,5,3,5,5,5,6)print    @a(2,4,5,3,5,5,5,6)-@a(1,3,4,2,3,4,2,4)sleep  `

Return to “General”

### Who is online

Users browsing this forum: No registered users and 11 guests