Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: p2 on June 17, 2011, 06:51:18 am
-
Is it possible to wrire the following Code in Axe language?
I want to make an APP of it, but don't think it would be possible.
:Lbl 2
:randInt(iPart(Xmin),iPart(Xmax))→A
:randInt(iPart(Ymin),iPart(Ymax))→B
:mean({Xmin,Xmax})→X
:mean({Ymin,Ymax})→Y
:Lbl 1
:Pt-On(X,Y
:Pt-On(A,B
:If A≥Xmax or A≤Xmin or B≥Ymax or B≤Ymin:Goto 2
:A→P
:B→Q
:If X>B:1→Z
:If X>B:-1→Z
:If Y>A:1→V
:If Y>A:-1→V
:A+Z→A
:If (Y-B)=0:B+1→B
:B+Vabs(((X-Z)-A)/(Y-B))→B
:If √((A-P)²+(B-Q)²)≥200:Goto 2 //200 is how long a streak could be (max.)
:Line(A,B,P,Q
:Goto 1
If you want to know what this program is doing, pleas copy the code on your TI.
I can't describe it in English. :-\
But Is it possible to write it in Axe Language?
-
While tihs could be technically made into Axe compatible code, it wouldn't be nearly as Axe-like as if it were simply just written in Axe from the bottom up. Good Axe coders don't start with BASIC code and convert to Axe, they start and end with Axe only ;)
-
Yes.
But is it possible to make an APP of this with Axe?
I ask because there are many decimals...
-
yes, that is possible. But since your topics use Xmax etc., it'll be hard to exmulate it exactly. I say you try to port it more conceptually than chenge it line by line, by maybe just plotting things using a simple hand-made algorithm, rather than try to make every line transfer over to Axe code.
-
I've just used Xmax, Xmin, Ymax and Ymin because else it would be a problem with the program.
You can use 0 as Xmin and as ymin and 94 as xmax.
62can be Ymax.
Can you please copy it on your TI and tell me how to discribe something like that?
(I don't know how to describe something like that in English)
Have you tried it?
-
Here's the closest conversion I could come up with. It's not optimized much, as I tried to make the conversion appear 1:1 as much as possible. It runs a lot smoother than the screenshot would suggest, I just recorded it at a low framerate to ensure that most browsers could view it at the correct speed.
EDIT: Also, it's entirely possible that this is not the effect you wanted, because I'm not sure if the code you posted originally is a fully correct copy of your program. Certain parts seemed strange, like:
:If X>B:1→Z
:If X>B:-1→Z
:If Y>A:1→V
:If Y>A:-1→V
-
Super! :D
thanx!
-
If you just want to convert it into an app, you don't need to rewrite it in Axe. Just use BasicBuilder (http://www.ticalc.org/archives/files/fileinfo/321/32127.html), a tool that packages BASIC programs into apps.
-
Why do you want to convert everything to axe. Axe is not ment for these thing. Axe is a language especially for games.
-
Why do you want to convert everything to axe. Axe is not ment for these thing. Axe is a language especially for games.
That's not true at all, actually. Axe excels at games because of it's asm like speed, but it is useful in other applications where speed is crucial, but precise math is not.
And I wouldn't suggest converting everything to axe, but yes, basicbuilder is a good choice for basic to app conversion.