Dear visitors and members, with the staff having moved on to other life interests and as a result of changes in people's internet usage habits, the CodeWalrus community have migrated almost entirely to Discord, IRC and WalrusIRC and is now essentially a place where to hang out, chat about gaming, programming, music, anime, and chill. As a result, even though the CW forums will remain open for posting, for faster TI, Casio or HP calculator help and news we recommend using the bilingual TI-Planet forums instead.

We encourage everyone to join our Discord server now.

* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: prgmMOVE and prgmARR: Teaching Myself to Move  (Read 3020 times)

0 Members and 1 Guest are viewing this topic.

Offline Woodrow

  • New User
  • Join Date: Jan 2018
  • Location: Miami, Florida
  • Posts: 9
  • Post Rating Ratio: +0/-0
  • Jack of all trades, master of none.
    • @@TheTreeOfComedy
    • eyeoftheaxolotl.tumblr.com
  • Gender: Female
prgmMOVE and prgmARR: Teaching Myself to Move
« on: January 22, 2018, 05:25:11 pm »
Here, I used the location of the numbers of the calculator as arrows.

prgmARR:

7->M
Input “”, M
If M=4: Y-1->Y
If M=6: Y+1->Y
If M=8: X-1->X
If M=2: X+1->X
If M=5: Stop
ClrHome
Output(X,Y,”O

prgmMOVE:

1->X
1->Y
Output(X,Y,”O
While 5=5:prgmARR:End:DelVar M

Goals:

Condense the code into one prgm

Use arrow keys instead of numbers if possible

Find a way to use the ClrHome command at the start of prgmMOVE

Add a boundary system


  • Calculators owned: TI-83+
  • Consoles, mobile devices and vintage computers owned: TI-83+, iPhone, Nintendo Switch, iPad, Kindle

Offline JWinslow23

  • Should my fans be called "Elephants", "Cookie Clickers", or "Descenders"?
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and 2↑↑↑6
  • Posts: 782
  • Post Rating Ratio: +13/-1
  • 99.999...% of mathematicians agree, tau > pi.
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
  • Gender: Male
Re: prgmMOVE and prgmARR: Teaching Myself to Move
« Reply #1 on: January 22, 2018, 06:39:07 pm »
I think what would help you here is the command getKey. It returns the last key pressed as a number based roughly on what row and column it's on on the keyboard (and 0 if nothing). For instance, the sin( key is in the 5th row and 2nd column, so you would check in this instance if getKey = 52. (In practice, you're almost always gonna want to store this to a variable and instead check that.)

The arrow keys are a bit more complicated. Up, left, and right are considered in the second row, and down is considered in the third row. So left is 24, up is 25, right is 26, and down is 34.

Also, any particular reason you have a While 5=5 loop?

Offline Woodrow

  • New User
  • Join Date: Jan 2018
  • Location: Miami, Florida
  • Posts: 9
  • Post Rating Ratio: +0/-0
  • Jack of all trades, master of none.
    • @@TheTreeOfComedy
    • eyeoftheaxolotl.tumblr.com
  • Gender: Female
Re: prgmMOVE and prgmARR: Teaching Myself to Move
« Reply #2 on: January 22, 2018, 09:38:39 pm »
Thanks! I'll keep that in mind and make a new program with the GetKey command.

While 5=5 is the way I usually write an infinite loop (5 is a visually satisfying number imo). Since the loop contains prgmARR, which has its own way of breaking out of the loop (If M=5:Stop), it's not really an infinite loop. It's just easier for me because error messages make me a bit nervous due to bad experience, so, even though I can break out with the On key either way, I prefer to just have my own ending function.

This is why I never try to justify my weird logic.
  • Calculators owned: TI-83+
  • Consoles, mobile devices and vintage computers owned: TI-83+, iPhone, Nintendo Switch, iPad, Kindle

Offline mazhat

  • Full User
  • Join Date: Mar 2017
  • Location:
  • Posts: 176
  • Post Rating Ratio: +7/-0
  • Edelweiss. Edelweiss.
    • /u/Mazhat
    • Mazhat
    • @Mazhat
    • MOS
  • Gender: Male
Re: prgmMOVE and prgmARR: Teaching Myself to Move
« Reply #3 on: January 22, 2018, 09:51:37 pm »
Not that it makes a difference, but you can write "While 5=5" as just "While 5".
You'll save yourself a whole two bytes!

  • Calculators owned: TI-83Plus, TI-84Plus
  • Consoles, mobile devices and vintage computers owned: Samsung TAB A (Cheap), DSI, Rasperry PI 3
The Mogami River.

Offline JWinslow23

  • Should my fans be called "Elephants", "Cookie Clickers", or "Descenders"?
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and 2↑↑↑6
  • Posts: 782
  • Post Rating Ratio: +13/-1
  • 99.999...% of mathematicians agree, tau > pi.
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
  • Gender: Male
Re: prgmMOVE and prgmARR: Teaching Myself to Move
« Reply #4 on: January 23, 2018, 02:46:10 pm »
Not that it makes a difference, but you can write "While 5=5" as just "While 5".
You'll save yourself a whole two bytes!


While 1, even!

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games