Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: p2 on June 26, 2011, 01:47:53 pm

Title: How to write that in Axe?
Post by: p2 on June 26, 2011, 01:47:53 pm
How to write the following Code in Axe?
I have no idea because there are only decimals.
{⌊A(1),⌊A(2)} is Point 1
{⌊A(3),⌊A(4)} is Point 2
Point 1 will follow Point 2 (always with steps of 1Pxl)
Code: [Select]
√((⌊A(1)-⌊A(3))²+(⌊A(2)-⌊A(4))²)→⌊A(5)
For(X,0,1,1
⌊A(1+X)-(((⌊A(1+X)>⌊A(3+X))-1)/2)abs(⌊A(1+X)-⌊A(3+X))/⌊A(5)→⌊A(1+X)
End
I hope everyone will understand this Code.
Title: Re: How to write that in Axe?
Post by: Deep Toaster on June 26, 2011, 02:24:18 pm
Hmm any particular reason you need this in Axe? Remember that if you need to make something math-intensive and speed isn't too much of an issue, BASIC is definitely the way to go. Especially since it seems like you're using LA, which is a BASIC variable.
Title: Re: How to write that in Axe?
Post by: p2 on June 27, 2011, 07:12:12 am
Then think of:
⌊A(1)=A
⌊A(2)=B
⌊A(3)=C
⌊A(4)=D
⌊A(5)=E

But then The code will be longer.
I've saved all in lists to make the program smaller.

It's a point whitch follows another point.
Title: Re: How to write that in Axe?
Post by: Ashbad on June 27, 2011, 08:13:10 am
Ported as close as possible and decently optimized.  Uses A, B, C, D, E:

Code: [Select]
√(A-B)²+(C-D)²→E
For(X,0,1)
-((({2*X+°A->Q}rr>{Q+4}rr)-1)/2)*abs({Q}rr-{Q+4}rr)/E→{Q}rr
End

But I agree with DeepThought -- writing code in BASIC first is NOT the way to go.  It's like writing a game in C and trying to port it line by line to JavaScript.  Not two flavors that go together well.  The only thing that Axe and BASIC have in common is that they both use TIOS tokens -- past there, you pretty much have to start learning it as if it's a whole new language -- which it is.

Title: Re: How to write that in Axe?
Post by: Deep Toaster on June 27, 2011, 01:27:35 pm
Ported as close as possible and decently optimized.  Uses A, B, C, D, E:

Code: [Select]
√(A-B)²+(C-D)²→E
For(X,0,1)
-((({2*X+°A->Q}rr>{Q+4}rr)-1)/2)*abs({Q}rr-{Q+4}rr)/E→{Q}rr
End

But I agree with DeepThought -- writing code in BASIC first is NOT the way to go.  It's like writing a game in C and trying to port it line by line to JavaScript.  Not two flavors that go together well.  The only thing that Axe and BASIC have in common is that they both use TIOS tokens -- past there, you pretty much have to start learning it as if it's a whole new language -- which it is.



^ That. Don't get me wrong; it's totally possible, but everything's just easier in some languages than others. Imagine a 3D platformer in BASIC.
Title: Re: How to write that in Axe?
Post by: AngelFish on June 27, 2011, 02:34:21 pm
The general rule of thumb that I follow is this: If it requires floating point math or more than four non-trivial math functions in the entire program, write it in BASIC or ASM. Otherwise, use Axe.