0 Members and 1 Guest are viewing this topic.
:Disp "SIZE?":Input X // Adds a "?" but its your choice:1→C:DelVar ADelVar B{X,X→dim([J]:For(A,1,X:For(B,1,X:C→[J](A,B:C+1→C:End:End:1→B:X+X/10^(1+int(log(X→l // Make sure 10^( is one token:Pause L:0→[J](X,X:ClrHome:For(θ,B,100:Output(1,1,B:Output(6,6,C:Output(4,4,det(4,0:C→n:0→C:Repeat C≠n:randInt(1,4→C:End:If C=1 and .1≠fPart(L:Then // Rearranged second term:‾1→M:Goto UD:End:If C=2 and X≠iPart(L:Then:1→M:Goto LR:End:If C=3 and (X/10)≠fPart(L:Then:1→M:Goto UD:End:If C=4 and 1≠iPart(L:Then:‾1→M:Goto LR:End:End:Lbl UD:[J](iPart(L),10fPart(L→A:[J](iPart(L),10fPart(L+M→[J](iPart(L),10fPart(L:A→[J](iPart(L),M+10fPart(L:L+M/10→L:B+1→B:End:End:Lbl LR:[J](iPart(L),10fPart(L→A:[J](iPart(L)+M,10fPart(L→[J](iPart(L),10fPart(L:A→[J](iPart(L)+M,10fPart(L:L+M→L:B+1→B:End:End:Disp [J]
:Input "?x? ",θ:{θ,θ→dim([A]:0→C:For(A,1,θ:For(B,1,θ:C→[A](A,B:C+1→C:End:End:Disp [A]:1→X:1→Y:For(A,1,θ2:randInt(1,4→B:X→W:Y→Z:Repeat X≠W or Y≠Z:randInt(1,4→B:X+(B=3)-(B=1→X:Y+(B=4)-(B=2→Y:X+(X=0)-(X=θ+1→X:Y+(Y=0)-(Y=θ+1→Y:End:[A](Z,W→C:[A](Y,X→[A](Z,W:C→[A](Y,X:End:Disp [A]
dim(L1→NFor(I,1,NrandInt(I,N→AL1(A→BL1(I→L(AB→L1(IEnd
rand(dim(L1→L2SortA(L2,L1
Here is an example of how to suffle L1 using the Fisher-Yates algorithm:Code: (TI Basic) [Select]dim(L1→NFor(I,1,NrandInt(I,N→AL1(A→BL1(I→L(AB→L1(IEndA faster method would be to do this (stolen from Weregoose):Code: (TI Basic) [Select]rand(dim(L1→L2SortA(L2,L1