Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
22 May, 2013, 09:41:41 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: Optimization Help -  (Read 1890 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
trevmeister66
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: 12 January, 2011, 01:00:06
Date Registered: 30 October, 2008, 08:31:38
Posts: 1067

Topic starter
Total Post Ratings: +9

View Profile
« on: 02 February, 2009, 00:03:11 »
0

Well it's been a long time since I've programmed on the calc, so I'm a little rusty. I was just wondering if someone could help me optimize this code for speed:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
ClrHome
"________->Str2   //8 Spaces in Str2
"_ABCDEFGHIJKLMNOPQRSTUVWXYZ->Str1
Ouput(1,1,"Whats your name?
Output(3,1,"NAME: "+Str2
7->X
8->dim(L1
For(Y,1,8
1->L1(Y
End
Repeat K=105
Output(2,X,"^   //up arrow
Output(4,X,"v   //down arrow
getKey->K
//Moves arrows left or right
If K=24 or K=26
Then
Output(2,X,"_    //_ = Blank Space
Output(4,X,"_    //_ = Blank Space
X+(K=26)-(K=24
Ans+8(Ans=6)-8(Ans=15->X
End
If K=25 or K=34
Then
L1(X-6
Ans+(K=25)-(K=34
Ans+27(Ans=0)-27(Ans=28->Z
If X=7
Then
sub(Str1,Z,1)+sub(Str2,2,7
End
If X>7 and X<14
Then
sub(Str2,1,X-7)+sub(Str1,Z,1)+sub(Str2,X-5,14-X
End
If X=14
Then
sub(Str2,1,7)+sub(Str1,Z,1
End
Ans->Str2
Z->L1(X-6
Output(3,7,Str2
End
End
//Delete all variables

If you need more information about what this program does, just ask.

« Last Edit: 02 February, 2009, 03:53:47 by trevmeister66 » Logged

Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit Smiley
kalan_vod
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 15 July, 2011, 07:40:04
Date Registered: 01 September, 2008, 01:02:11
Posts: 2992


Total Post Ratings: +9

View Profile WWW
« Reply #1 on: 02 February, 2009, 01:43:24 »
0

What does this program accomplish, I have better luck sometimes just re-writing it.
Logged
trevmeister66
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: 12 January, 2011, 01:00:06
Date Registered: 30 October, 2008, 08:31:38
Posts: 1067

Topic starter
Total Post Ratings: +9

View Profile
« Reply #2 on: 02 February, 2009, 03:37:27 »
0

It lets the person create a 8-max letter name. They can move left or right and change the letter at that position. Every time you change a letter (by pressing up or down) it recreates the String (Str2) and displays it again. I know there's easier and faster ways to do it, but I also want it to look good instead of just entering it like normal.
Logged

Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit Smiley
{AP}
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 19 May, 2013, 14:35:25
Date Registered: 16 October, 2008, 04:08:37
Location: TX
Posts: 987


Total Post Ratings: +65

View Profile WWW
« Reply #3 on: 02 February, 2009, 03:48:29 »
0

Minor problem.
Look below... it shows it. (only hitting the arrows... the error happens on pressing up/down on the 2nd space)
This is just a direct copy of your code above.

I was testing it before I play with the optimizing... and that happened.
Can't find the issue... (maybe just too tired...)


* name.gif (16.45 KB, 96x64 - viewed 113 times.)
Logged

trevmeister66
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: 12 January, 2011, 01:00:06
Date Registered: 30 October, 2008, 08:31:38
Posts: 1067

Topic starter
Total Post Ratings: +9

View Profile
« Reply #4 on: 02 February, 2009, 03:52:45 »
0

Heh I know why. In the code that say

1
If X>8 and X<14
should be

1
If X>7 and X<14

Heh I have it right in my program.
Logged

Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit Smiley
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 07:31:30
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50214


Total Post Ratings: +2613

View Profile WWW
« Reply #5 on: 02 February, 2009, 04:16:48 »
0

nice, kinda like Illusiat 12 naming routine (also used in Illusiat 2004)
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
trevmeister66
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: 12 January, 2011, 01:00:06
Date Registered: 30 October, 2008, 08:31:38
Posts: 1067

Topic starter
Total Post Ratings: +9

View Profile
« Reply #6 on: 02 February, 2009, 04:18:19 »
0

nice, kinda like Illusiat 12 naming routine (also used in Illusiat 2004)
O snap. Do you think you have the code for that lying around anywhere? I'd like to take a look at it and see what differences we have and see what I can improve on.
Logged

Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit Smiley
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 07:31:30
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50214


Total Post Ratings: +2613

View Profile WWW
« Reply #7 on: 02 February, 2009, 04:23:03 »
0

Well, I doubt it is a good example. Back in the days (2002-2003) I was still using lbls/gotos inside loops, and some parhentesis were closed and " not omitted at the end of strings, just to give you an idea. If I have time to dig up the code I will post it though, but it's horrible. I would most likely do signifiantly better today.
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
trevmeister66
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: 12 January, 2011, 01:00:06
Date Registered: 30 October, 2008, 08:31:38
Posts: 1067

Topic starter
Total Post Ratings: +9

View Profile
« Reply #8 on: 02 February, 2009, 04:25:32 »
0

Heh yeah I understand, but it never hurts to look at it even just to see how it works (even if it is unoptimized). but if you don't have it right now it's all good.
Logged

Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit Smiley
kalan_vod
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 15 July, 2011, 07:40:04
Date Registered: 01 September, 2008, 01:02:11
Posts: 2992


Total Post Ratings: +9

View Profile WWW
« Reply #9 on: 02 February, 2009, 07:31:51 »
0

I made a small one, hope it works for what you want:



[Download 8xp]

Quote from: BASIC Code
:ClrHome:1→A:"ABCDEFGHIJKLMNOPQRSTUVWXYZ →Str0:"-→Str1:8→dim(L1:Fill 1,L1
:Output(1,1,"WHATS YOUR NAME?
:Output(4,1,"NAME:
:Repeat θ=21
:L[size=0]1[/size](A→B
:Repeat θ=21 or θ=26 or θ=24
:A+6
:Output(3,Ans,"
:Output(5,Ans,"
:Output(4,Ans,sub(Str0,B,1
:getKey→θ
:B+(Ans=34)-(Ans=25
:Ans-27((Ans=28)-not(Ans→B
:End
:sub(Str0,Ans,1
:If θ=24:Then:"
:Output(4,A+6,Ans:End
:sub(Str1,1,A)+Ans→Str1
:inString(Str0,sub(Ans,A+1,1→L[size=0]1[/size](A
:A+6
:Output(3,Ans,"
:Output(5,Ans,"
:A+(θ=26 and A≠8)-(θ=24 and A≠1→A
:End
:sub(Str1,2,Ans→Str1
Logged
trevmeister66
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: 12 January, 2011, 01:00:06
Date Registered: 30 October, 2008, 08:31:38
Posts: 1067

Topic starter
Total Post Ratings: +9

View Profile
« Reply #10 on: 02 February, 2009, 08:01:03 »
0

Thanks! That's a lot better.
Logged

Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit Smiley
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 07:31:30
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50214


Total Post Ratings: +2613

View Profile WWW
« Reply #11 on: 02 February, 2009, 08:57:13 »
0

I assume these are the characters added in OS 1.15 or higher? This looks nice actually
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
kalan_vod
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 15 July, 2011, 07:40:04
Date Registered: 01 September, 2008, 01:02:11
Posts: 2992


Total Post Ratings: +9

View Profile WWW
« Reply #12 on: 02 February, 2009, 09:13:44 »
0

I believe so kevin, you can get them in tifreaks font pack on ticalc. I actually now see a few optimizations in my own code..ew
Logged
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 07:31:30
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50214


Total Post Ratings: +2613

View Profile WWW
« Reply #13 on: 04 February, 2009, 08:14:05 »
0

moved to calculator help and support
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.2 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.