This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-Freak8x subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Pokemon Purple => TI-Freak8x
Author Message
tifreak8x


Elite


Joined: 27 Aug 2005
Posts: 956

Posted: 30 Aug 2008 02:25:58 pm    Post subject:

Quote:
If F=2.5:Then
LEPA(43->Z
"0ZAL
prgmZRS
prgmTEMP
"0
prgmZRS
dimLAL->dim(LAM
1->A
While LEPA(46)>=iPart(LAL(A
LAL(A->LAM(A
A+1->A
End
dim(LAM->A
While LAM(A)=0
A-1->A
End
A->dim(LAM:3->B
"0ZAD
prgmZRS
While A>0 and B<7
fPart(LAM(A))E3->LEPA(B
LEPA(B->Z
prgmTEMP
Ans-LT
LT(1->LEPA(B+12
LT(2->LEPA(B+4
LT(3->LEPA(B+8
LT(4->LEPA(B+16
LT(4->LEPA(B+20
LT(5->LEPA(B+50
B+1->B
A-1->A
End
End


What this code does is give the pokemon its attacks. This part of the program takes roughly 9 seconds to run. The rest of the stat generation runs in under 2 seconds, which I can find acceptable. Any ideas or hints on how I could speed this up drastically?
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 30 Aug 2008 03:06:19 pm    Post subject:

Assuming all stats are positive, try replacing this:

dim(LAM→A
While LAM(A)=0
A-1→A
End
A→dim(LAM

...with this:

cumSum(LAM
1+sum(Ans≠max(Ans→dim(LAM

This will work faster only if there are plenty of zeros at the end of LAM.

[EDIT]

Also, in LEPA(B→Z, it'd be faster to access Ans repeatedly.


Last edited by Guest on 30 Jul 2010 04:49:49 am; edited 1 time in total
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 30 Aug 2008 03:41:04 pm    Post subject:

See if this works:

Code:
If F=2.5:Then
LEPA(43->Z
"0ZAL
prgmZRS
prgmTEMP
"0
prgmZRS
cumSum(LALnot(cumSum(LEPA(46)<iPart(LAL
1+sum(Ans!=max(Ans->A
3->B
"0ZAD
prgmZRS
While A>0 and B<7
E3fPart(LAL(A->LEPA(B
Ans->Z
prgmTEMP
Ans->LT
LT(1->LEPA(B+12
LT(2->LEPA(B+4
LT(3->LEPA(B+8
LT(4->LEPA(B+16
LT(4->LEPA(B+20
LT(5->LEPA(B+50
B+1->B
A-1->A
End
End


I got rid of LAM completely since you can just read the elements from LAL in the last loop. All you need to find is the value of A.

Edit: Fixed a typo where Ans was used instead of LAL


Last edited by Guest on 30 Aug 2008 03:43:39 pm; edited 1 time in total
Back to top
tifreak8x


Elite


Joined: 27 Aug 2005
Posts: 956

Posted: 30 Aug 2008 07:13:35 pm    Post subject:

Weregoose wrote:
Assuming all stats are positive, try replacing this:

dim(LAM→A
While LAM(A)=0
A-1→A
End
A→dim(LAM

...with this:

cumSum(LAM
1+sum(Ans≠max(Ans→dim(LAM

This will work faster only if there are plenty of zeros at the end of LAM.

[EDIT]

Also, in LEPA(B→Z, it'd be faster to access Ans repeatedly.
[post="126492"]<{POST_SNAPBACK}>[/post]


So, it would be faster to store Ans to both the list element and variable Z? I have to store to both because the list element is attack name, and Z gathers the attack data :/


Last edited by Guest on 30 Jul 2010 04:51:23 am; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 30 Aug 2008 10:26:12 pm    Post subject:

E3fPart(LAM(A→LEPA(B
Ans→Z

Just like what calc84maniac did in his code (except his is using LAL).


Last edited by Guest on 30 Jul 2010 04:48:32 am; edited 1 time in total
Back to top
tifreak8x


Elite


Joined: 27 Aug 2005
Posts: 956

Posted: 31 Aug 2008 10:17:31 am    Post subject:

Well... still sitting at 9 seconds... anything else?

Edit: hmm, upon further inspecting, seems it one of the attacks twice to the pokemon... That is why I had the second list, was to keep from having that kind of problem..


Last edited by Guest on 31 Aug 2008 10:19:59 am; edited 1 time in total
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 31 Aug 2008 08:08:19 pm    Post subject:

tifreak8x wrote:
Well... still sitting at 9 seconds... anything else?

Edit: hmm, upon further inspecting, seems it one of the attacks twice to the pokemon... That is why I had the second list, was to keep from having that kind of problem..
[post="126499"]<{POST_SNAPBACK}>[/post]

Could the duplicate be because of the:

Code:
LT(4->LEPA(B+16
LT(4->LEPA(B+20
Back to top
tifreak8x


Elite


Joined: 27 Aug 2005
Posts: 956

Posted: 31 Aug 2008 11:32:47 pm    Post subject:

No, the attack itself is LEPA(B

The rest is stats for attacks and such. There was no problem with duplicates before. How ever, it is nice to know that it is seeing more than 2 attacks. :)

I am thinking on a way to rewrite all of that code to be smaller and faster... I have tomorrow off, so when I take my breaks from learning asm or whatever I am doing tomorrow, I will look at it again.
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 03 Sep 2008 07:10:35 am    Post subject:

Try commenting out each line with a " to find the problem. Note: you'll have to change the -> to a . or something when you comment it out.
Back to top
tifreak8x


Elite


Joined: 27 Aug 2005
Posts: 956

Posted: 03 Sep 2008 08:36:15 am    Post subject:

I looked into that, those pieces of code are not slowing it down, as they happen instantly. I am truly not sure what is slowing it down, probably the recall attack data program... I wonder if things speed up if I split them up into smaller programs...
Back to top
JoostinOnline


Active Member


Joined: 22 Aug 2007
Posts: 559

Posted: 03 Sep 2008 10:47:00 am    Post subject:

Have you been testing the program by itself, or only when run as a subroutine? It could just be that you have something slowing it down in the main program right before it runs.
Back to top
tifreak8x


Elite


Joined: 27 Aug 2005
Posts: 956

Posted: 03 Sep 2008 03:02:28 pm    Post subject:

I tested the routines individually. F=1 runs in less than a second, iPart(F)=2 runs in less than 2, but F=2.5 runs over 9 seconds. I am certain it has to do with the while loops, just not certain at this time what to do to replace them.
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 03 Sep 2008 07:14:37 pm    Post subject:

ZRS is called twice. This looks like a potential slow down.
Back to top
tifreak8x


Elite


Joined: 27 Aug 2005
Posts: 956

Posted: 03 Sep 2008 09:11:51 pm    Post subject:

prgmZRS has one line in it, :Asm(prgmRESOURCE :P

I have shaved some time off of it, hoping to take off more now, by separating the attack data program. So far, took the LT out of the picture entirely, and added some :If Z<##:Return into the code to shave off 2 seconds.

Edit:

Splitting the attack data program in to two pieces shaved this off to just under 6 seconds.


Last edited by Guest on 03 Sep 2008 10:05:08 pm; edited 1 time in total
Back to top
tifreak8x


Elite


Joined: 27 Aug 2005
Posts: 956

Posted: 10 Sep 2008 07:22:35 pm    Post subject:

Well, a bit of an update. I took and recombined the attack data programs, removed all the If Z=###: and made it so Celtic2 will read the data at the lines. This as shaved miliseconds off... So it is now nearly 5 seconds flat. It is not terrible, however, I am still hoping to improve it. I am, however, running into problems with it displaying incorrect data.

I am going to revert back to the original code, optimize some of it, and see if I can see what part of the code is causing the troubles.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement