Author Topic: Learning Axe! And made a program  (Read 3741 times)

0 Members and 1 Guest are viewing this topic.

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Learning Axe! And made a program
« on: November 22, 2011, 08:00:40 pm »
Ok, I am learning Axe! Yay! <insert applause here>
My program lets you use the arrow keys to move a circle around the screen and change its velocity!!! :w00t:
Added a cool feature!
The circle gets larger the faster it's going!
It's still a bit buggy, but here it is!

At the end, the circle stops instantly. Do this with [DEL]. [CLEAR] exits the program.
Attached : SVELDRAW is the source, and VELOCITY is the compiled program.
Source code:
Code: [Select]
:.VELOCITY
:0→A
:0→B
:1→X
:1→Y
:While 1
:Pause 180
:If getKey(4)
:B-1→B
:End
:If getKey(1)
:B+1→B
:End
:If getKey(2)
:A-1→A
:End
:If getKey(3)
:A+1→A
:End
:If getKey(56)
:0→A
:0→B
:End
:If getKey(15)
:Return
:End
:Y+B→Y
:X+A→X
:If X>>96
:1→X
:End
:If X<<1
:96→X
:End
:If Y>>64
:1→Y
:End
:If Y<<1
:64→Y
:End
:A+B→R
:If R<<1
:If R=0
:Circle(X,Y,1)
:Else
:Circle(X,Y,‾R)
:End
:Else
:Circle(X,Y,R)
:End
:DispGraphClrDraw
:End
Optimizations, suggestions, bug reports?
« Last Edit: November 23, 2011, 03:59:32 pm by Spyro543 »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Learning Axe! And made a program
« Reply #1 on: November 22, 2011, 08:03:43 pm »
You need to use >> for signed comparison. X>96 returns 1 when X is less than zero (since the unsigned value of a negative number is somewhere between 32,768 and 65,535). Same thing with Y.




Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Learning Axe! And made a program
« Reply #2 on: November 22, 2011, 08:03:47 pm »
* epic7 applauds


I found that alot of my bugs were involved with that.
I changed the check for the left side of the screen to >100, but does <<1 work for that?
« Last Edit: November 22, 2011, 08:05:40 pm by epic7 »

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Learning Axe! And made a program
« Reply #3 on: November 22, 2011, 08:04:59 pm »
Applause! I'll look at the code.

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: Learning Axe! And made a program
« Reply #4 on: November 22, 2011, 08:09:41 pm »
Great! That is an awesome start!
« Last Edit: November 22, 2011, 08:09:51 pm by annoyingcalc »
This used to contain a signature.

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Learning Axe! And made a program
« Reply #5 on: November 22, 2011, 09:02:37 pm »
Hooray!!!!! it seems like yesterday that i was making these programs... :D

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Learning Axe! And made a program
« Reply #6 on: November 23, 2011, 03:46:17 pm »
Added a cool feature!
The circle gets larger the faster it's going!
It's still a bit buggy, but here it is!

At the end, the circle stops instantly. Do this with [key][DEL][/key]. [key][CLEAR][/key] exits the program.
Attached : SVELDRAW is the source, and VELOCITY is the compiled program.
Source code:
Code: [Select]
:.VELOCITY
:0→A
:0→B
:1→X
:1→Y
:While 1
:Pause 180
:If getKey(4)
:B-1→B
:End
:If getKey(1)
:B+1→B
:End
:If getKey(2)
:A-1→A
:End
:If getKey(3)
:A+1→A
:End
:If getKey(56)
:0→A
:0→B
:End
:If getKey(15)
:Return
:End
:Y+B→Y
:X+A→X
:If X>>96
:1→X
:End
:If X<<1
:96→X
:End
:If Y>>64
:1→Y
:End
:If Y<<1
:64→Y
:End
:A+B→R
:If R<<1
:If R=0
:Circle(X,Y,1)
:Else
:Circle(X,Y,‾R)
:End
:Else
:Circle(X,Y,R)
:End
:DispGraphClrDraw
:End
Optimizations, suggestions, bug reports?

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Learning Axe! And made a program
« Reply #7 on: November 23, 2011, 04:02:53 pm »
Optimizations:

:0→A
:0→B
:1→X
:1→Y

Can be 1 line. It optimizes to
:0->A->B+1->X->Y

Instead of doing
A+1->A and
A-1->A,
Use

A++ and
A--

Instead of
If R=0
Use
!If R

And do you need the >>
When seeing if its greater than 96 and 64?
I don't think its needed but I might be wrong because I'm not experienced with them since I just figured out they existed yesterday :P
« Last Edit: November 23, 2011, 04:06:02 pm by epic7 »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Learning Axe! And made a program
« Reply #8 on: November 23, 2011, 04:09:03 pm »
That looks really cool.  I like how the circle gets bigger with its velocity; it's a cool effect.
Great job on your first Axe program. ;D

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Learning Axe! And made a program
« Reply #9 on: November 23, 2011, 04:10:26 pm »
I had countless problems getting it work (especially if I moved up or left or stood still the circle changed into this huge X thing :O) but I finally got it working! (Took a few periods in school tho :P)

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Learning Axe! And made a program
« Reply #10 on: November 23, 2011, 04:14:38 pm »
I was programming in school before. My teacher took it away and I started freaking out. She said she thought I was doing "innapropriate things" because of my "over-the-top reaction" :P

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Learning Axe! And made a program
« Reply #11 on: November 23, 2011, 04:18:42 pm »
I was programming in school before. My teacher took it away and I started freaking out. She said she thought I was doing "innapropriate things" because of my "over-the-top reaction" :P
is that even possible on a calc?

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Learning Axe! And made a program
« Reply #12 on: November 23, 2011, 04:27:27 pm »
That's exactly what I was thinking when she said that.

Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Learning Axe! And made a program
« Reply #13 on: November 24, 2011, 02:09:03 pm »
That sucks. Oh well, teachers are hardly ever appreciating or even acknowledging calculator program.
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Learning Axe! And made a program
« Reply #14 on: December 01, 2011, 03:23:34 pm »
I turned the velocity program into some fun bouncy program :D
Attached is a screenshot, SVELDRAW (source), and BOUNCE (executable). Press [CLEAR] to exit, [DEL] to reset the velocity, and arrow keys to move the ball.

That sucks. Oh well, teachers are hardly ever appreciating or even acknowledging calculator program.
Well, I showed this program to my science teacher, and he really liked it (both the program and that I'm interested in physics.)
« Last Edit: December 01, 2011, 03:26:03 pm by Spyro543 »