If it was at the very top of the program, there wouldn't be a noticeable size difference at all, but yes, the loop would still marginally be the faster of the two methods.
I was optimizing curious onlooker's newer version of AntiNibblz (before he releases it) and I found a great optimization for size and a slight speed improvement (by slight, the only difference is that there are fewer lines to read through, thus it is faster).
The code is good for things that require something to be done every set number of loops, say 10, but it isn't in a For( loop (it still works in for loops).
Code:
:IS>(B,1+10int(B/10
:Pxl-On(RandInt(1,61),RandInt(1,92
It of course can be modified for other use, and B is the variable that is going through (the example is for every 10th
:0->C
:While iPart(A
:C+1->C
:A/10->A
:End
:"0123456789->Str0
:" ->Str9
:If A<0
:Then
:Str9+"-->Str9
:-A->A
:End
:While fPart(A
:If not(C
:Str9+".->Str9
:10A->A
:Str9+sub(Str0,iPart(A)+1,1->Str9
:A-iPart(A->A
:C-1->C
:End
:If Str9="
:" 0->Str9
:sub(Str9,2,length(Str9)-1->Str9
:DelVar CWhile iPart(A
:C+1->C
:.1A->A
:End
:" ->Str9
:If A<0
:Then
:Str9+"-->Str9
:-A->A
:End
:While fPart(A
:If not(C
:Str9+".->Str9
:10A->A
:Str9+sub("0123456789",iPart(A)+1,1->Str9
:A-iPart(A->A
:C-1->C
:End
:If Str9="
:" 0->Str9
:sub(Str9,2,length(Str9)-1->Str9
{A,A->L2
{0,1->L1
LinReg(a+bx) Y1
Equ>String(Y1,Str1
sub(Str1,1,length(Str1)-3->Str1
{A,A->L2
{0,1->L1
LinReg(a+bx) Y1
Equ>String(Y1,Str1
sub(Str1,1,length(Str1)-3->Str1
ΔList(cumSum(Ans
rowSwap(Ans<superscript T thing>,1,3
{A,A->L2
{0,1->L1
LinReg(a+bx) Y1
Equ>String(Y1,Str1
sub(Str1,1,length(Str1)-3->Str1
{A,A->L2
{0,1->L1
0->dim(LIST2
For(Z,1,dim(LIST1
sum(LIST1=LIST1(Z->LIST2(Z
End
max(LIST2->A
For(Z,1,dim(LIST2
If A=LIST2(Z:Goto 0
End
Lbl 0:LIST1(Z
0->A
dim(LIST1->dim(LIST2:Ans->dim(LIST3
For(Z,1,dim(LIST1
Lbl 0
randInt(1,dim(LIST1->X
X->LIST3(Z
If X=A:Goto 0
If 1<sum(X=LIST3:Goto 0
LIST1(Z->LIST2(X
X->A
End
LIST2->LIST1
Pause LIST1
0->A
dim(LIST1->dim(LIST2:Ans->dim(LIST3
For(Z,1,dim(LIST1
Lbl 0
randInt(1,dim(LIST1->X
X->LIST3(Z
If X=A:Goto 0
If 1<sum(X=LIST3:Goto 0
LIST1(Z->LIST2(X
X->A
End
LIST2->LIST1
Pause LIST1
rand(dim(L1→L2
SortA(L2,L1
Advertisement
Advertisement