Should I make an 8x8 version?
Yes, I'll use it
 50%  [ 2 ]
No, most people who use icons use 16x16 ones.
 50%  [ 2 ]
Total Votes : 4

Weregoose wrote:
[...]Oh, and:


Code:
K=15 or K=34 or 1=abs(3-int(.1K
I knew there was one of those in there somewhere. Smile Nicely done, sir.
See my post here.

For reference, it replaces the following:

Code:
:If int(50length(Str1)/256)=0
:Then
:Text(46,85,0
:Else
:Text(46,85-4iPart(log(50length(Str1)/256)),int(50(length(Str1)/256
:End
The one I said was final was not, and neither will this one be (unless a whole day goes by without any optimizations). Clock starts 1:00 PM Central time, 28 October 2009.

Note that I removed the 5.12^-1... SC throws up an error whenever I try to export as 8XP. That optimization does not work.

SourceCoder wrote:
Program Data Size:2777
Type: Program


Code:
::"Icon Editor for the 83+
::"7FF0411057105450567052505E48404440687FF4000CEEE948AD48AB48A9EEE9
:Lbl ST
:ClrDraw
:PlotsOff
:FnOff
:AxesOff
:0→[]:1→[]
:0→[]:1→[]
:For(A,-1,64,4
:Vertical X+1
:Line(0,X,64,X
:End
:Text(0,66,"[CLEAR]"
:Text(6,77,"=Quit"
:Text(31,66,"[DEL]="
:Text(37,83,"Clr")
:Line(77,0,77,5
:Line(78,6,94,6
:Text(57,79,"Save"
:1→C:1→D
:Lbl Z
:Repeat 0
:Delvar KPxl-Change(4C-2,4D-1
:Pxl-Change(4C-4,4D-1
:Pxl-Change(4C-2,4D-3
:Pxl-Change(4C-4,4D-3
:Repeat K=15 or K=34 or 1=abs(3-int(.1K
:getKey→K
:End
:If K=22:Goto M1
:If K≥42 and K≤44
:Then
:{16,16→dim([]
:For(A,1,16)
:4A-3→Y
:For(B,1,16)
:Pxl-Off(A+13,B+70
:pxl-Test(Y,4B-1→[](A,B
:Pxl-Change(Y,4B-2
:End:End
:End
:If K=43 or K=44
:Then
:For(Z,1,8)
:rowSwap([],Z,17-Z→[]
:End
:End
:If K=42 or K=44
:Then
:[]^T^→[]
:For(Z,1,8)
:rowSwap([],Z,17-Z→[]
:End
:[]^T^→[]
:End
:If K≥42 and K≤44
:Then
:For(A,1,16)
:For(B,1,16)
:If [](A,B
:Then
:For(E,4A-4,4A-2)
:For(F,4B-3,4B-1)
:Pxl-On(E,F
:End:End
:Pxl-On(A+13,B+70
:Else
:For(E,4A-4,4A-2)
:For(F,4B-3,4B-1)
:Pxl-Off(E,F
:End:End
:Pxl-Off(A+13,B+70
:End
:End
:End
:End
:If K=41
:Then
:For(A,1,16)
:For(B,1,16)
:For(E,4A-4,4A-2)
:For(F,4B-3,4B-1)
:Pxl-Change(E,F
:End:End
:Pxl-Change(A+13,B+70
:End:End
:End
:If K≥24 and K≤26 or K=34 or K=41
:Then
:Pxl-Change(4C-2,4D-1)
:Pxl-Change(4C-2,4D-3)
:Pxl-Change(4C-4,4D-1)
:Pxl-Change(4C-4,4D-3)
:End
:D-(K=24 and D≠1)+(K=26 and D≠16)→D
:C-(K=25 and C≠1)+(K=34 and C≠16)→C
:If K=21
:Then
:Pxl-Change(4C-2,4D-2
:Pxl-Change(4C-3,4D-1
:Pxl-Change(4C-3,4D-2
:Pxl-Change(4C-3,4D-3
:Pxl-Change(4C-4,4D-2
:Pxl-Change(C+13,D+70
:End
:If K=23:Goto ST
:If K=15:Goto SA
:If K=45:Goto Q
:End
:End
:Lbl M1
:Pxl-Change(4C-2,4D-1
:Pxl-Change(4C-2,4D-3
:Pxl-Change(4C-4,4D-1
:Pxl-Change(4C-4,4D-3
:Lbl M
:Menu("Recall what?    ","Kerm's Icons",KI,"Yarnot Icons",YI,"Last Icon made",LI,"...Back",Z
:Lbl KI
:Menu("Recall what? (K)","Folder icon",FI,"BASIC prog icon",BI,"ASM prog icon",AI,"ION prog icon",II,"DCS prog icon",DI,"...Back",M
:Lbl YI
:Menu("Recall what? (Y)","Group icon",GI,"Flash App icon",FA,"...Back",M
:Lbl LI
:0:Asm(prgmSTREXIST
:If Ans=1:Then
:If length(Str0)≥66:Then
:For(X,3,66)
:If inString("0123456789ABCDEF",sub(Str0,X,1))=0:Goto Z
:End
:sub(Str0,3,64→Str3:End
:Else:Goto Z
:End:
:Goto Y
:Lbl FI
:"000038F04708801C80E2870288045004500450045008503033C03C0000000000→Str3
:Goto Y
:Lbl BI
:"C000A000E6D392849654E6D300000004FB86A93F2106738400337F4A00490033→Str3
:Goto Y
:Lbl AI
:"200050005368FA5489548B5400000004FB86A93F2106738400337F4A00490033→Str3
:Goto Y
:Lbl II
:"7DD2822D6EAD2AA52AA96EAD822D7DD200000006380B5C2F8EA6DE80FEA67C2B→Str3
:Goto Y
:Lbl DI
:"7FD27FD54FD543C941C041D141D145D141CE41C041CE31110D11031F00000000→Str3
:Goto Y
:Lbl GI
:"38F04708801C80E28702880455545FFC5AAC500851F036003B66045505660354→Str3
:Goto Y
:Lbl FA
:"1000299829547D984510451200000004FB86A93F2106738400337F4A00490033→Str3
:Lbl Y
:" "→Str4
:For(X,1,64)
:Str4+sub("0000100110101111000",inString("0124936DA5B7FEC8",sub(Str3,X,1)),4→Str4
:For(Y,16fPart(X/4)+1,16fPart(X/4)+4)
:Pxl-Change(4iPart(X/4)+1,4Y-2
:Pxl-Off(iPart(X/4)+14,Y+70
:End
:End
:For(X,1,16)
:For(Y,1,16)
:For(U,4X-3,4X-1)
:For(V,4Y-3,4Y-1)
:If sub(Str4,Y+16X-16)="1"
:Then:Pxl-On(U,V)
:Else:Pxl-Off(U,V)
:End
:End:End
:If sub(Str4,Y+16X-16)="1":Pxl-On(Y+13,X+70)
:End:End
:Goto Z
:Lbl SA
:Text(46,85,"[]
:Text(46,85,"   
:":→Str1
:For(C,1,16)
:4C-3→Y
:For(D,1,16)
:Str1+sub("01",pxl-Test(Y,4D-1)+1),1→Str1
:Pxl-Change(4C-3,4D-2
:If int(50length(Str1)/256)=0
:Then
:Text(46,85,0
:Else
:Text(46,85-4iPart(log(50length(Str1)/256)),int(50(length(Str1)/256
:End
:End:End
:sub(Str1,2,length(Str1)-1→Str1
:":→Str0
:For(X,1,length(Str1),4)
:Text(46,85-4iPart(log(50(X/255)+50)),int(50(X/255)+50
:Str0+sub("0124936DA5B7FEC8",inString("0000100110101111000",sub(Str1,X,4)),1→Str0
:End
:sub(Str0,2,length(Str0)-1→Str0
:"AsmPrgm:"+Str0+"49636F6E2046696C6500C9→Str0
:Text(46,77,100
:Pause
:Lbl Q
:ClrDraw
:ClrHome
:Output(1,1,"
Got another one for you, perhaps the last one I'll be posting in this thread.

Original:

Code:
:If K≥42 and K≤44
:Then
:For(A,1,16)
:For(B,1,16)
:If [A](A,B
:Then
:For(E,4A-4,4A-2)
:For(F,4B-3,4B-1)
:Pxl-On(E,F
:End:End
:Pxl-On(A+13,B+70
:Else
:For(E,4A-4,4A-2)
:For(F,4B-3,4B-1)
:Pxl-Off(E,F
:End:End
:Pxl-Off(A+13,B+70
:End
:End
:End
:End

Optimized for speed:

Code:
:If 1≥abs(K-43
:Then
:For(A,1,16
:For(B,1,16
:4B-2
:If [A](A,B
:Then
:Pxl-On(4A-3,Ans
:Pt-On(Ans,65-4A,2
:Pxl-On(A+13,B+70
:Else
:Pxl-Off(4A-3,Ans
:Pt-Off(Ans,65-4A,2
:Pxl-Off(A+13,B+70
:End
:End
:End
:End

The second one should be running at over 250% the speed of the former.

I can understand wanting to use matrices for their charactertistic 2-D shape when doing sprite work, but a 16×16 matrix is nine times the size of the corresponding string. It'd be good practice to try to figure out the algebra for doing sprite reflection and so forth – not that I'm asking you to redo this program by any means, but it's perhaps something to muse about.

Xeno_Cre8or wrote:
Note that I removed the 5.12^-1... SC throws up an error whenever I try to export as 8XP. That optimization does not work.

I just carried it out again. The optimization works fine, although not necessarily in SourceCoder. If need be, add a byte and write it like so:

Code:
:length(Str1)/5.12

How long can Str1 be in this code, by the way?
Xeno, write me a bug report in the SourceCoder bugs thread, I'll take a look.
The clock has started to tick again. Ends 8:30 AM, 30 October 2009 CST.

Weregoose wrote:
Got another one for you, perhaps the last one I'll be posting in this thread.

Original:

Code:
:If K≥42 and K≤44
:Then
:For(A,1,16)
:For(B,1,16)
:If [A](A,B
:Then
:For(E,4A-4,4A-2)
:For(F,4B-3,4B-1)
:Pxl-On(E,F
:End:End
:Pxl-On(A+13,B+70
:Else
:For(E,4A-4,4A-2)
:For(F,4B-3,4B-1)
:Pxl-Off(E,F
:End:End
:Pxl-Off(A+13,B+70
:End
:End
:End
:End

Optimized for speed:

Code:
:If 1≥abs(K-43
:Then
:For(A,1,16
:For(B,1,16
:4B-2
:If [A](A,B
:Then
:Pxl-On(4A-3,Ans
:Pt-On(Ans,65-4A,2
:Pxl-On(A+13,B+70
:Else
:Pxl-Off(4A-3,Ans
:Pt-Off(Ans,65-4A,2
:Pxl-Off(A+13,B+70
:End
:End
:End
:End

The second one should be running at over 250% the speed of the former.

I can understand wanting to use matrices for their charactertistic 2-D shape when doing sprite work, but a 16×16 matrix is nine times the size of the corresponding string. It'd be good practice to try to figure out the algebra for doing sprite reflection and so forth – not that I'm asking you to redo this program by any means, but it's perhaps something to muse about.

Xeno_Cre8or wrote:
Note that I removed the 5.12^-1... SC throws up an error whenever I try to export as 8XP. That optimization does not work.

I just carried it out again. The optimization works fine, although not necessarily in SourceCoder. If need be, add a byte and write it like so:

Code:
:length(Str1)/5.12

How long can Str1 be in this code, by the way?


I believe it gets as big as 256 tokens, but it might be as small as 64 tokens.

KermMartian wrote:
Xeno, write me a bug report in the SourceCoder bugs thread, I'll take a look.


Will do.
Xeno_Cre8or wrote:
Weregoose wrote:
How long can Str1 be in this code, by the way?

I believe it gets as big as 256 tokens, but it might be as small as 64 tokens.

Okay. What is 85-4iPart(log(50length(Str1)/256)) in that range?
Weregoose wrote:
Xeno_Cre8or wrote:
Weregoose wrote:
How long can Str1 be in this code, by the way?

I believe it gets as big as 256 tokens, but it might be as small as 64 tokens.

Okay. What is 85-4iPart(log(50length(Str1)/256)) in that range?

That is so that the percentage, 50length(Str1)/256 (ranging from 0 to 256) right aligns at 85. Taking iPart(log(X)) tells you how many digits an integer X has, multipliyng it by 4 because each number takes up 4 pixels (3 for the digit, 1 for the space), and subtracting the result from 85 tells where to put the text so it appears right alligned.

In answer to your question, if the percent is 9 or less, it is 81. 10-99 makes it 77, 100 makes it 73.
I'm aware of the purpose, but would you care to check your work on that?
Weregoose wrote:
I'm aware of the purpose, but would you care to check your work on that?


How do you mean, "Check your work"? That piece of code was written back when the calc wasn't missing, and it worked as intended.
Fact: The numbers being produced by that code are 85 for lengths 1 through 51, and 81 for 52 all the way up through 511. If you need different sources to help you verify this, I can think of a couple.
Weregoose wrote:
Fact: The numbers being produced by that code are 85 for lengths 1 through 51, and 81 for 52 all the way up through 511. If you need different sources to help you verify this, I can think of a couple.


By sources, you mean source codes?
Xeno_Cre8or wrote:
Weregoose wrote:
Fact: The numbers being produced by that code are 85 for lengths 1 through 51, and 81 for 52 all the way up through 511. If you need different sources to help you verify this, I can think of a couple.


By sources, you mean source codes?

No, I mean a different locations from which information can be retrieved. Someplace other than a calculator where you can punch in your numbers to get accurate results. A source of information.
Weregoose wrote:
Xeno_Cre8or wrote:
Weregoose wrote:
Fact: The numbers being produced by that code are 85 for lengths 1 through 51, and 81 for 52 all the way up through 511. If you need different sources to help you verify this, I can think of a couple.


By sources, you mean source codes?

No, I mean a different locations from which information can be retrieved. Someplace other than a calculator where you can punch in your numbers to get accurate results. A source of information.


I didn't mean to say I'm helpless without the calc, I just mean that that code, on the calc, performed as intended.
So does the rest of the code. I was bringing about a point of optimization, but I suppose that by not explicitly stating it, it just can't be realized when one doesn't have a calculator on one's person.
Weregoose wrote:
So does the rest of the code. I was bringing about a point of optimization, but I suppose that by not explicitly stating it, it just can't be realized when one doesn't have a calculator on one's person.


So I should write it as


Code:
:If length(str1)>52
Then
Text(??,85,blabla
Else
Text(??,81,blablabla
End
Question Question Question
Or, better yet:

Code:
:length(Str1
:Text(46,85-4(Ans>51),int(Ans/5.12
Weregoose wrote:
Or, better yet:

Code:
:length(Str1
:Text(46,85-4(Ans>51),int(Ans/5.12

Thanks. Current optimization clock ends at 2:45PM, 30 October 2009 CST.

Current code:


Code:
::"Icon Editor for the 83+
::"7FF0411057105450567052505E48404440687FF4000CEEE948AD48AB48A9EEE9
:Lbl ST
:ClrDraw
:PlotsOff
:FnOff
:AxesOff
:0→Xmin:1→ΔX
:0→Ymin:1→ΔY
:For(A,-1,64,4
:Vertical X+1
:Line(0,X,64,X
:End
:Text(0,66,"[CLEAR]"
:Text(6,77,"=Quit"
:Text(31,66,"[DEL]="
:Text(37,83,"Clr")
:Line(77,0,77,5
:Line(78,6,94,6
:Text(57,79,"Save"
:1→C:1→D
:Lbl Z
:Repeat 0
:Delvar KPxl-Change(4C-2,4D-1
:Pxl-Change(4C-4,4D-1
:Pxl-Change(4C-2,4D-3
:Pxl-Change(4C-4,4D-3
:Repeat K=15 or K=34 or 1=abs(3-int(.1K
:getKey→K
:End
:If K=22:Goto M1
:If K≥42 and K≤44
:Then
:{16,16→dim([A]
:For(A,1,16)
:4A-3→Y
:For(B,1,16)
:Pxl-Off(A+13,B+70
:pxl-Test(Y,4B-1→[A](A,B
:Pxl-Change(Y,4B-2
:End:End
:End
:If K=43 or K=44
:Then
:For(Z,1,8)
:rowSwap([A],Z,17-Z→[A]
:End
:End
:If K=42 or K=44
:Then
:[A]{^T}→[A]
:For(Z,1,8)
:rowSwap([A],Z,17-Z→[A]
:End
:[A]{^T}→[A]
:End
:If 1≥abs(K-43
:Then
:For(A,1,16)
:For(B,1,16)
:4B-2
:If [A](A,B
:Then
:Pxl-On(4A-3,Ans
:Pt-On(Ans,65-4A,2
:Pxl-On(A+13,B+70
:Else
:Pxl-Off(4A-3,Ans
:Pt-Off(Ans,65-4A,2
:Pxl-Off(A+13,B+70
:End
:End
:End
:End
:If K=41
:Then
:For(A,1,16)
:For(B,1,16)
:For(E,4A-4,4A-2)
:For(F,4B-3,4B-1)
:Pxl-Change(E,F
:End:End
:Pxl-Change(A+13,B+70
:End:End
:End
:If K≥24 and K≤26 or K=34 or K=41
:Then
:Pxl-Change(4C-2,4D-1)
:Pxl-Change(4C-2,4D-3)
:Pxl-Change(4C-4,4D-1)
:Pxl-Change(4C-4,4D-3)
:End
:D-(K=24 and D≠1)+(K=26 and D≠16)→D
:C-(K=25 and C≠1)+(K=34 and C≠16)→C
:If K=21
:Then
:Pxl-Change(4C-2,4D-2
:Pxl-Change(4C-3,4D-1
:Pxl-Change(4C-3,4D-2
:Pxl-Change(4C-3,4D-3
:Pxl-Change(4C-4,4D-2
:Pxl-Change(C+13,D+70
:End
:If K=23:Goto ST
:If K=15:Goto SA
:If K=45:Goto Q
:End
:End
:Lbl M1
:Pxl-Change(4C-2,4D-1
:Pxl-Change(4C-2,4D-3
:Pxl-Change(4C-4,4D-1
:Pxl-Change(4C-4,4D-3
:Lbl M
:Menu("Recall what?    ","Kerm's Icons",KI,"Yarnot Icons",YI,"Last Icon made",LI,"...Back",Z
:Lbl KI
:Menu("Recall what? (K)","Folder icon",FI,"BASIC prog icon",BI,"ASM prog icon",AI,"ION prog icon",II,"DCS prog icon",DI,"...Back",M
:Lbl YI
:Menu("Recall what? (Y)","Group icon",GI,"Flash App icon",FA,"...Back",M
:Lbl LI
:0:Asm(prgmSTREXIST
:If Ans=1:Then
:If length(Str0)≥66:Then
:For(X,3,66)
:If inString("0123456789ABCDEF",sub(Str0,X,1))=0:Goto Z
:End
:sub(Str0,3,64→Str3:End
:Else:Goto Z
:End:
:Goto Y
:Lbl FI
:"000038F04708801C80E2870288045004500450045008503033C03C0000000000→Str3
:Goto Y
:Lbl BI
:"C000A000E6D392849654E6D300000004FB86A93F2106738400337F4A00490033→Str3
:Goto Y
:Lbl AI
:"200050005368FA5489548B5400000004FB86A93F2106738400337F4A00490033→Str3
:Goto Y
:Lbl II
:"7DD2822D6EAD2AA52AA96EAD822D7DD200000006380B5C2F8EA6DE80FEA67C2B→Str3
:Goto Y
:Lbl DI
:"7FD27FD54FD543C941C041D141D145D141CE41C041CE31110D11031F00000000→Str3
:Goto Y
:Lbl GI
:"38F04708801C80E28702880455545FFC5AAC500851F036003B66045505660354→Str3
:Goto Y
:Lbl FA
:"1000299829547D984510451200000004FB86A93F2106738400337F4A00490033→Str3
:Lbl Y
:" "→Str4
:For(X,1,64)
:Str4+sub("0000100110101111000",inString("0124936DA5B7FEC8",sub(Str3,X,1)),4→Str4
:For(Y,16fPart(X/4)+1,16fPart(X/4)+4)
:Pxl-Change(4iPart(X/4)+1,4Y-2
:Pxl-Off(iPart(X/4)+14,Y+70
:End
:End
:For(X,1,16)
:For(Y,1,16)
:For(U,4X-3,4X-1)
:For(V,4Y-3,4Y-1)
:If sub(Str4,Y+16X-16)="1"
:Then:Pxl-On(U,V)
:Else:Pxl-Off(U,V)
:End
:End:End
:If sub(Str4,Y+16X-16)="1":Pxl-On(Y+13,X+70)
:End:End
:Goto Z
:Lbl SA
:Text(46,85,"I%
:Text(46,85,"   
:":→Str1
:For(C,1,16)
:4C-3→Y
:For(D,1,16)
:Str1+sub("01",pxl-Test(Y,4D-1)+1),1→Str1
:Pxl-Change(4C-3,4D-2
:length(Str1
:Text(46,85-4(Ans>51),int(Ans/5.12
:End:End
:sub(Str1,2,length(Str1)-1→Str1
:":→Str0
:For(X,1,length(Str1),4)
:Text(46,85-4iPart(log(50(X/255)+50)),int(50(X/255)+50
:Str0+sub("0124936DA5B7FEC8",inString("0000100110101111000",sub(Str1,X,4)),1→Str0
:End
:sub(Str0,2,length(Str0)-1→Str0
:"AsmPrgm:"+Str0+"49636F6E2046696C6500C9→Str0
:Text(46,77,100
:Pause
:Lbl Q
:ClrDraw
:ClrHome
:Output(1,1,"
Now, where else do you think you might be able to apply that optimization...?
Weregoose wrote:
Now, where else do you think you might be able to apply that optimization...?


Oh, dough!
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement