Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: 3.1415926535 on August 13, 2009, 07:41:19 pm
-
My first program!
its a simple screen inverter thing.
I'd liek to know if anyone can help me optimize it and tell me why. thanks!
1→E:94→F
:1→A:1→B
:For(C,0,46,1)
:For(D,0,61,1)
:Pxl-Change(A,B)
:Pxl-Change(E,F)
:A+1→A
:E+1→E
:End
:B+1→B
:F-1→F
:1→E
:1→A
:End
-
:For(A,0,62
:For(B,0,94
:Pxl-Change(A,B
:End:End
You don't need closing parentheses and the increment on the for is option and defaults to 1. Really alot of the code is filler and can just be simplified to this.
Formatted your post too.
-
how do you format?
and thanks!
-
code tags. [code ] code here [/code ] with out the spaces.
-
i'm sorry if i'm sounding really stupid, but what are tags? and how do you get them
-
how bout this program? =)
:Input "ROW=",R
:R-1→R
:If R
:2^Rbinompdf(R,.5)
-
hmm i think this is more optimized probally more that can be done though
:Input "ROW=",R
:R-1→R
:removed because it is not needed? works without
:2^Rbinompdf(R,.5 removed last parenthesy [ ) ] that
umm randdom q whats binompdf do ?
-
Crazy shit http://tibasicdev.wikidot.com/binompdf
-
0.0 i see what you mean noah thanks 0.0
-
oooo thanks!
I'm trying to make an inverter program that inverts diagonally instead of horizontally or vertically.
Any ideas how to do this?
-
why do i always get a domain error when i run this program?
:5→I
:AxesOff:FnOff
:DispGraph
:Pxl-Change(X,Z+1
:Pxl-Change(X-1,Z
:Pxl-Change(X,Z-1
:Repeat A=1
:0:Repeat Ans
:getKey→K
:End
:Pxl-Change(X,Z-1
:Pxl-Change(X-1,Z
:Pxl-Change(X,Z+1
:K:X-I((Ans=25)-(Ans=34)→X
:K:Z+I((Ans=26)-(Ans=24)→Z
:(K=21 or K=105)→A
:Z+I((Z≤0)-(Z≥94)→Z
:X+I((X≤0)-(X≥60)→X
:Pxl-Change(X,Z+1
:Pxl-Change(X-1,Z
:Pxl-Change(X,Z-1
:End
:Return
Edit: when i press the goto option, it always points back to the pxl-Change(x-1,z
-
why do i always get a domain error when i run this program?
I think you need to initialize X and Z first, since you might be trying to change a pixel with non-integer/negative/big coordinates.
-
oh yeah i forgot to store a value to x and z. haha silly me