Author Topic: [UPDATE] Speed Order Program  (Read 33254 times)

0 Members and 1 Guest are viewing this topic.

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
[UPDATE] Speed Order Program
« on: May 16, 2010, 11:35:12 pm »
This is the current program for the ARMY speed order.

Code: [Select]
:.SPDORDER
:Disp "Loading...
:"vARMYOrdr→Str1
:GetCalc(Str1)→θ
:If θ=0
:GetCalc(Str1,100)→θ
:For(X,0,99
:rand→{θ+X
:End
:End
:conj(θ,L1,100
:1→A
:While A
:0→A
:For(X,0,99
:If {L1+X}<{L1+X+1}
:expr(L1+X,L1+X+1,1
:1→A
:End
:End
:End
:1→A
:Fill 0→{L2},100
:For(X,0,99
:{θ+X}→Z
:For(Y,0,99
:If Z={L1+Y}
:(Y+1)→{L2+X}
:End
:End
:End
:For(X,0,99
:Disp {L2+X}►Dec,i
:Repeat getKey
:End
:End

If anyone has any optimizations for this, that would be nice.
And, if anyone can patch up the little problem that occurs with duplicates (The problem is that the same value is assigned to duplicates.), that would be nice as well.
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







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: [UPDATE] Speed Order Program
« Reply #1 on: May 17, 2010, 05:06:28 pm »
Let's see, I see one little thing:
If θ=0
could be
!If θ

I'm not the best at optimizing for Axe, so I wouldn't doubt if more optimizations are out there.  Good luck! ;D

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [UPDATE] Speed Order Program
« Reply #2 on: May 17, 2010, 11:05:59 pm »
I'm not sure if I understand "Fill 0→{L2},100"

Isn't it Fill(, not Fill?

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: [UPDATE] Speed Order Program
« Reply #3 on: May 17, 2010, 11:14:09 pm »
That's weird.
I copied this from SourceCoder 2 over at Cemetech.
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [UPDATE] Speed Order Program
« Reply #4 on: May 17, 2010, 11:15:23 pm »
Oh, I think SC2 had some issues with commands. I should maybe report them to KermMartian unless it was already reported before. Horizontal changes to Horizontal(

I can't find optimizations, though
« Last Edit: May 17, 2010, 11:16:09 pm by DJ Omnimaga »

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: [UPDATE] Speed Order Program
« Reply #5 on: May 18, 2010, 12:47:32 am »
I found several, but before I post, could you explain what you're trying to do from start to finish?  It appears you're sorting a list first and then sorting another list the same way as the first one right after?  I know how to sort both at the same time if that's what your trying to do.  Can you give me an example of what input and output should be?

Also, how useful would a sort command be?  I was going to add it later, but maybe I can whip one up for the next version.  It would probably be SortA(ptr,size) to sort size bytes in the array at ptr or you can use an optional 3rd argument SortA(ptr,size,ptr2) to sort the data at the second pointer in the same order as the first.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: [UPDATE] Speed Order Program
« Reply #6 on: May 18, 2010, 01:11:29 am »
A sort command would indeed be useful, although what algorithm would you end up using?  There would be tradeoff's between size and speed, like bubble vs something like quicksort.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: [UPDATE] Speed Order Program
« Reply #7 on: May 18, 2010, 01:13:54 am »
It would probably use quicksort since it sorts in place, is simple and small to code, and computes in nlog(n) time.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [UPDATE] Speed Order Program
« Reply #8 on: May 18, 2010, 01:53:16 am »
Sort would come handy for example in RPG item menus, where items are listed from the lowest to highest item type ID. See for example Illusiat 13.

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: [UPDATE] Speed Order Program
« Reply #9 on: May 18, 2010, 06:45:53 am »
SortA() and SortD() would be very useful!
:D

Quigibo, basically, I'm trying to take values from the AppVar and throw them in a list. Then, I copy that list to another list and sort that one. Then, going down the list, it compares the values of the sorted list to the unsorted AppVar and assigns a number in ANOTHER list. It is this list that I need.

tl;dr - It produces a list of (Offset+1). The order of units in essence.
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







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: [UPDATE] Speed Order Program
« Reply #10 on: May 18, 2010, 04:39:17 pm »
I like the idea of SortA( and SortD(.  Those would be useful in Axe! ;D

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: [UPDATE] Speed Order Program
« Reply #11 on: May 18, 2010, 06:50:40 pm »
i would think the arguments would be SortA(addr,bytes) for an 8-bit val sort and SortA(addr,words)r for 16-bit.
for consistency.
Edit: If no one has, someone should suggest it to quigibo on the Features Wishlist thread.
« Last Edit: May 18, 2010, 06:52:05 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [UPDATE] Speed Order Program
« Reply #12 on: May 18, 2010, 08:00:06 pm »
What would addr stands for?


Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: [UPDATE] Speed Order Program
« Reply #13 on: May 18, 2010, 08:01:23 pm »
address of place to start sorting
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [UPDATE] Speed Order Program
« Reply #14 on: May 18, 2010, 08:07:21 pm »
oooh ok. I tend to have troubles with acronyms x.x