Author |
Message |
|
spandiv -- Retired --
Active Member
Joined: 25 May 2003 Posts: 650
|
Posted: 06 Sep 2007 12:42:53 am Post subject: |
|
|
Inspired by the recent code optimization game hosted at Omnimaga, I thought it would be fun to do something similar here at UTI. While the goal is still to optimize programs as much as possible, the programs will now come from none other then ticalc.org. People always complain how there are lots of TI-Basic programs at ticalc.org that are crappily made and optimized, so now's the chance to improve some of those programs (and have fun while doing it *cue evil laugh*).
Once everybody feels that a program is sufficiently optimized, somebody can pick a new program. When posting a program, please provide the name of the program and a link to it so people can download the program, change all of the TI-Basic tokens that don't display correctly to Unicode or something recognizable to most people (i.e., --> would be a store arrow), preface each line of code with a colon (:), and use [code/], [codebox/], or [goose/] tags (whatever makes sense to you).
I'll start us off:
Frogger -- http://www.ticalc.org/archives/files/fileinfo/274/27401.html
Code: [goose]:ClrHome
:99→I
:Goto M
:Lbl 01
:Output(8,1,"8="
:Output(8,3,[i]n[/i]
:Output(8,7,I
:Output(8,11,S
:1→D
:-1→E
:1→F
:-1→G
:2→W
:0→S
:Lbl AA
:7→R
:8→C
:randInt(3,14)→Z
:randInt(3,14)→θ
:randInt(4,12)→X
:randInt(4,12)→Y
:X→J
:Y→K
:Z→L
:θ→P
:Output(R,C,"8"
:Output(6,J,"OOOO"
:Output(5,K,"OOOO"
:For(T,1,16,1)
:For(U,2,3,1)
:Output(U,T,"X"
:End
:End
:Output(3,L," "
:Output(2,P," "
:Lbl 99
:Output(8,1,"8="
:Output(8,3,[i]n[/i]
:Output(8,7,I
:Output(8,11,S
:Output(5,1," "
:Output(6,1," "
:Output(5,16," "
:Output(6,16," "
:Output(R,C,"8"
:getKey→M
:If M=24
:Then
:Output(R,C," "
:C-1→C
:If C=1
:2→C
:Output(R,C,"8"
:End
:If M=25
:Then
:Output(R,C," "
:R-1→R
:If R=1
:Goto YW
:Output(R,C,"8"
:End
:If M=26
:Then
:Output(R,C," "
:C+1→C
:If C=16
:15→C
:Output(R,C,"8"
:End
:If M=34
:Then
:Output(R,C," "
:R+1→R
:If R=8
:7→R
:Output(R,C,"8"
:End
:If D=1
:Output(6,J," "
:If D=-1
:Output(6,J+3," "
:If J=13
:-1→D
:If J=1
:1→D
:J+D→J
:Output(6,J,"OOOO"
:Output(6,16," "
:If E=1
:Output(5,K," "
:If E=-1
:Output(5,K+3," "
:If K=13
:-1→E
:If K=1
:1→E
:K+E→K
:Output(5,K,"OOOO"
:Output(2,P,"X"
:Output(3,L,"X"
:If P=15
:-1→G
:If P=2
:1→G
:P+G→P
:If L=15
:-1→F
:If L=2
:1→F
:L+F→L
:Output(2,P," "
:Output(3,L," "
:If R=3 and (L-1≤C and C≤L+1)
:L→C
:If R=2 and (P-1≤C and C≤P+1)
:P→C
:If (R=6 and (J≤C and C≤J+3) or (R=5 and (K≤C and C≤K+3) or (R=3 and C≠L) or (R=2 and C≠P) or I≤0
:Goto YL
:If R=2 and (P-1≤C≤P+1)
:P→C
:If R=3 and (L-1≤C≤L+1)
:L→C
:I-1→I
:Goto 99
:End
:Goto 99
:Lbl YL
:If I≤0
:Then
:ClrHome
:Disp "TIME UP!"
:Pause
:99→I
:[i]n[/i]-1→[i]n[/i]
:If [i]n[/i]≤0
:Goto GO
:ClrHome
:Goto AA
:End
:If R=6 or R=5
:Then
:ClrHome
:Disp "BUMP!"
:Disp "BUMP!"
:Pause
:ClrHome
:End
:ClrHome
:If R=2 or R=3
:Then
:Disp "SPLASH!"
:Disp "BLUB..."
:Disp "BLUB..."
:Disp "BLUB......"
:Pause
:ClrHome
:End
:[i]n[/i]-1→[i]n[/i]
:99→I
:If [i]n[/i]≥1
:Goto AA
:Lbl GO
:Menu(" TRY AGAIN? ","YES",θ1,"NO",θ
:Lbl θ1
:0→S
:99→I
:Goto M
:End
:End
:Lbl YW
:Output(R,C,"8"
:Pause
:ClrHome
:Disp "CONGRATULATIONS!"
:Output(4,1,I
:Output(4,3,"*"
:Output(4,4,"50="
:Output(4,7,(50*I))
:S+(50I)→S
:99→I
:Pause
:ClrHome
:Goto AA
:End
:Lbl M
:Menu(" FROGGER v1.0 ","PLAY",U1,"HELP",H1,"EXIT",θ)
:Lbl H1
:ClrHome
:Disp "YOU ARE THE 8.","TRY NOT TO GET","HIT BY THE OOOO","OR DROWN IN THE",
"XXXXXXXXXXXXXXXX","HURRY OVER TO ","THE OTHER SIDE!"
:Pause
:ClrHome
:Goto M
:End
:Lbl U1
:Menu(" DIFFICULTY ","TADPOLE",D1,"POLYWOG",D2,"FROG",D3,"BULL FROG",D4)
:Lbl D1
:9→[i]n[/i]
:Goto 01
:End
:Lbl D2
:8→[i]n[/i]
:Goto 01
:End
:Lbl D3
:7→[i]n[/i]
:Goto 01
:End
:Lbl D4
:6→[i]n[/i]
:Goto 01
:End
:Lbl θ
:ClrHome
:Disp "JUDE NELSON","3/13-15/2002"
:Pause
:ClrHome[/goose]
Last edited by Guest on 25 Sep 2010 03:01:19 pm; edited 1 time in total |
|
Back to top |
|
|
vuurrobin
Advanced Member
Joined: 09 Aug 2006 Posts: 428
|
Posted: 06 Sep 2007 10:30:00 am Post subject: |
|
|
oncalc size: 1622 bytes
:2→W
:0→S
to
:delvarS2→W
oncalc size: 1621
yay, I saved a byte
I'll see what I can optimise
Last edited by Guest on 25 Sep 2010 03:01:43 pm; edited 1 time in total |
|
Back to top |
|
|
bananaman Indestructible
Calc Guru
Joined: 12 Sep 2005 Posts: 1124
|
Posted: 06 Sep 2007 11:34:50 am Post subject: |
|
|
If only I remembered to bring my link cable to college. For some weird reason I can't stand looking at code on my comp, I can only do stuff on calc. |
|
Back to top |
|
|
Xphoenix
Elite
Joined: 04 Apr 2007 Posts: 756
|
Posted: 06 Sep 2007 05:29:46 pm Post subject: |
|
|
Should we post the part that we optimized? Or just the whole thing with our optimization added? |
|
Back to top |
|
|
spandiv -- Retired --
Active Member
Joined: 25 May 2003 Posts: 650
|
Posted: 06 Sep 2007 05:41:23 pm Post subject: |
|
|
You can post whatever optimizations you see; remember the goal is to make the program as optimized as possible. |
|
Back to top |
|
|
Xphoenix
Elite
Joined: 04 Apr 2007 Posts: 756
|
Posted: 06 Sep 2007 06:06:35 pm Post subject: |
|
|
That program has issues with ending quotes in outputs, and some ending parenthesis here and there.
Also, that code is structured horribly, with all those labels making it jump all over the place... Unless that's necessary for some reason I can't think of because I've only glanced at it. But I doubt it. |
|
Back to top |
|
|
spandiv -- Retired --
Active Member
Joined: 25 May 2003 Posts: 650
|
Posted: 06 Sep 2007 06:14:29 pm Post subject: |
|
|
How would you restructure the program? |
|
Back to top |
|
|
Xphoenix
Elite
Joined: 04 Apr 2007 Posts: 756
|
Posted: 06 Sep 2007 06:23:18 pm Post subject: |
|
|
In the beginning, for instance, it jumps all the way to the end of the program. Why not just place that block of code at the beginning?
BTW, is this:
P-1≤C≤P+1
useful at all? It seems to always be true.
Last edited by Guest on 25 Sep 2010 03:02:03 pm; edited 1 time in total |
|
Back to top |
|
|
alexrudd pm me if you read this
Bandwidth Hog
Joined: 06 Oct 2004 Posts: 2335
|
Posted: 06 Sep 2007 06:33:25 pm Post subject: |
|
|
How much easier could this get? Improved version (924). I also made it faster, while I was at it.
Last edited by Guest on 06 Sep 2007 06:33:57 pm; edited 1 time in total |
|
Back to top |
|
|
spandiv -- Retired --
Active Member
Joined: 25 May 2003 Posts: 650
|
Posted: 06 Sep 2007 06:33:42 pm Post subject: |
|
|
Xphoenix wrote: In the beginning, for instance, it jumps all the way to the end of the program. Why not just place that block of code at the beginning?
BTW, is this:
P-1≤C≤P+1
useful at all? It seems to always be true. I'm pretty sure the reason he has the Goto at the beginning of the program is for speed reasons. If you have a large program, where speed is the main issue, then you want the main program loop as close to the beginning of the program as possible. This technique is obsolete in this program because it's pretty small, so you're definitely right.
The way the calculator executes expressions is from left to right, so that expression would be the same thing as (P-1≤C)≤P+1. It could be true or false.
Last edited by Guest on 25 Sep 2010 03:02:32 pm; edited 1 time in total |
|
Back to top |
|
|
Xphoenix
Elite
Joined: 04 Apr 2007 Posts: 756
|
Posted: 06 Sep 2007 06:59:56 pm Post subject: |
|
|
But because P is never negative (I think), and there is a +1 there, won't that always be true? The first part, P-1≤C will either be 1 or 0, and then adding one to a positive number will make sure that it is always true.
Last edited by Guest on 25 Sep 2010 03:03:07 pm; edited 1 time in total |
|
Back to top |
|
|
Delnar_Ersike Lazy H4xx0r
Active Member
Joined: 24 Dec 2006 Posts: 578
|
Posted: 06 Sep 2007 07:12:58 pm Post subject: |
|
|
Here is alexrudd's program's optimized code, for those of you who don't know about or are too lazy to use SourceCoder:
Code: [goose]::"Frogger
:getKey
:ClrHome
:4→F
:[[1,1,1,1][1,1,1,1→[A]
:{3,16→dim([A]
:Disp "FROGGER v1.3"," Alex Ruddick
:For(A,1,E9
:Output(3,5,"LEVEL
:Output(3,11,A
:Output(4,3,"LOADING.
:sub("(oo)θ==θ",1+4int(2rand),4→Str0
:For(C,0,1
:Str0
:Repeat 16=length(Ans
:Ans+"
:If length(Ans)≤11 and A≥randInt(1,9
:Ans+" "+Str0
:End
:Output(4,11+C,".
:If C:Then
:Ans+Ans→Str2
:For(E,5,16
:" "≠sub(Str2,E,1
:Ans→[A](2,E
:Output(4,13,".
:End:Else
:Ans+Ans→Str1
:For(E,5,16
:" "≠sub(Str1,E,1
:Ans→[A](1,E
:End:End:End
:randInt(1,16
:Ans→[A](3,Ans
:Output(4,7,"ED: GO!
:Output(1,1,"================
:Output(1,Ans,"
:Repeat not([A](3,Ans
:randInt(1,16
:End
:Ans→[A](3,Ans
:Output(1,Ans,"
:Repeat not([A](3,Ans
:randInt(1,16
:End
:Ans→[A](3,Ans
:Output(1,Ans,"
:For(B,1,3
:8→C:8→D
:Repeat C≤1
:For(E,1,16
:sub(Str1,E,16
:Output(2,1,Ans
:Output(4,1,Ans
:sub(Str1,17-E,16
:Output(3,1,Ans
:Output(6,1,Ans
:sub(Str2,E,16
:Output(5,1,Ans
:Output(7,1,Ans
:Output(C,D,"X
:getKey
:If Ans:Then
:Output(C,D,"
:If Ans=24 and D>1
:D-1→D
:If Ans=26 and D<16
:D+1→D
:If Ans=25
:C-1→C
:If Ans=34 and C<8
:C+1→C
:Output(8,1,"
:End
:Output(C,D,"X
:If C≠1:Then
:D+E-1
:If C=3 or C=6
:D-E
:[A](1+(C=5 or C=7)+(C=1),Ans-16(Ans>16)+16(Ans<1
:If Ans and C≠8
:Goto A
:Else
:If not([A](3,D
:Goto A
:0→[A](3,D
:16→E
:End
:Lbl B
:End
:End
:Output(2,3,"SAFE AT LAST!
:Send(A
:getKey
:End
:End
:Lbl A
:If C=8
:End
:Output(C,D,"*
:Output(8,6,"SPLAT! ("+sub("0123",F,1)+")
:8→C:8→D
:Send(A
:Output(8,6,"
:DS<(F,1
:Goto B
:ClrHome
:"[/goose]
Last edited by Guest on 25 Sep 2010 03:03:32 pm; edited 1 time in total |
|
Back to top |
|
|
spandiv -- Retired --
Active Member
Joined: 25 May 2003 Posts: 650
|
Posted: 06 Sep 2007 07:50:20 pm Post subject: |
|
|
Xphoenix wrote: But because P is never negative (I think), and there is a +1 there, won't that always be true? The first part, P-1≤C will either be 1 or 0, and then adding one to a positive number will make sure that it is always true. You are correct that P is never negative. Sorry about the mistake.
Last edited by Guest on 25 Sep 2010 03:04:33 pm; edited 1 time in total |
|
Back to top |
|
|
Xphoenix
Elite
Joined: 04 Apr 2007 Posts: 756
|
Posted: 06 Sep 2007 07:57:10 pm Post subject: |
|
|
Oh, wait, in similar code a couple lines above, the author used ands to correctly separate the two. So I guess he meant:
:If R=2 and (P-1≤C and C≤P+1)
:P→C
:If R=3 and (L-1≤C and C≤L+1)
:L→C
Which could be optimized by removing the parenthesis.
Last edited by Guest on 25 Sep 2010 03:04:52 pm; edited 1 time in total |
|
Back to top |
|
|
simplethinker snjwffl
Active Member
Joined: 25 Jul 2006 Posts: 700
|
Posted: 07 Sep 2007 02:41:18 pm Post subject: |
|
|
spandiv wrote: I'm pretty sure the reason he has the Goto at the beginning of the program is for speed reasons. If you have a large program, where speed is the main issue, then you want the main program loop as close to the beginning of the program as possible. This technique is obsolete in this program because it's pretty small, so you're definitely right.
If you have a large program that needs to be fast, wouldn't it be faster to have the labels at the beginning of the program? The calc scans for labels starting from top to bottom, so the farther down it is, the longer it will take.
There are some reasons for having a program go directly to the bottom. If you have a menu with 'quit' in it, you can have it end at the end of the program and save bytes by not having to do a If:Then:(cleanup stuff):Stop statement. |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)
Joined: 25 Nov 2004 Posts: 3976
|
Posted: 07 Sep 2007 11:10:47 pm Post subject: |
|
|
I'm certain that there is more to contribute to this thread (and more having to do with that code), so I am opening it again; if the person who closed it sends me a PM expressing why it's a good idea to keep it closed, then I will see to it shortly thereafter. For now, the discussion will remain open to the public. |
|
Back to top |
|
|
spandiv -- Retired --
Active Member
Joined: 25 May 2003 Posts: 650
|
Posted: 08 Sep 2007 06:01:55 am Post subject: |
|
|
Weregoose wrote: I'm certain that there is more to contribute to this thread (and more having to do with that code), so I am opening it again; if the person who closed it sends me a PM expressing why it's a good idea to keep it closed, then I will see to it shortly thereafter. For now, the discussion will remain open to the public. I was actually the person that closed the thread. The reason is because I decided to rethink the motivation for the thread, and I didn't want to have any additional posts in the intermittent period. Since it's obvious that people are somewhat hesitant to post optimizations, I think it makes sense to simply let the person that posted the program have the first crack at optimizations, and then we can build off of that. This will hopefully make the thread progress better. Does this change make sense to you guys? Or, do you guys think we should just stick to the original idea?
Since I was the guy who posted the program, I went ahead and optimized the Frogger program so that it now has a straightforward structure, and also got the majority of the simple optimizations out of the way. I also got rid of all of the unnecessary features in the program. I'm looking forward to seeing what optimizations you guys can come up with.
EDIT: I attached the latest version of the program to this post, in case anyone wants to optimize it on their calculator.
Code: [goose]:ClrHome
:Disp "FROGGER v1.0
:Disp "1) Tadpole
:Disp "2) Polywog
:Disp "3) Bull Frog
:Repeat max(Ans={9,8,7
:101-getkey→[i]n[/i]
:End
:DelVar SWhile [i]n[/i]
:99→I:1→D:1→F
:-1→E:Ans→G:7→R:8→C
:randInt(3,14→P
:randInt(3,14→L
:randInt(4,12→K
:randInt(4,12→J
:"XXXXXXXX
:ClrHome
:Output(2,1,Ans+Ans+Ans+Ans
:Output(8,1,"8=
:Output(8,3,[i]n[/i]
:Output(8,11,S
:While I and R>1 and not(R=6 and J≤C and C≤J+3 or R=5 and K≤C and C≤K+3 or R=3 and C≠L or R=2 and C≠P
:Output(8,7,I
:getKey→M
:If Ans=45:Goto Q
:If max(Ans={24,25,26,34
:Output(R,C," "
:max(2,min(15,C+(Ans=26)-(Ans=24→C
:min(7,R+(M=34)-(M=25→R
:Output(Ans,C,8
:Output(6,J+3(D<0)," "
:D(J>1 and J<13)+(J=1)-(J=13→D
:J+Ans→J
:Output(6,Ans,"OOOO
:Output(6,1," "
:Output(6,16," "
:Output(5,K+3(E<0)," "
:E(K>1 and K<13)+(K=1)-(K=13→E
:K+Ans→K
:Output(5,Ans,"OOOO
:Output(5,1," "
:Output(5,16," "
:Output(2,P,"X
:Output(3,L,"X
:G(P>2 and P<15)+(P=2)-(P=15→G
:P+Ans→P
:Output(2,Ans," "
:F(L>2 and L<15)+(L=2)-(L=15→F
:L+Ans→L
:Output(3,Ans," "
:If R=3 and L-1≤C and C≤L+1
:L→C
:If R=2 and P-1≤C and C≤P+1
:P→C
:I-1→I
:End
:ClrHome
:"TIME UP!
:If I
:sub("BUMP! WATER!",1+6(R=2 or R=3),6
:If R=1
:"CONGRATS!
:Pause Ans
:S+50I(R=1→S
:[i]n[/i]-(R≠1→[i]n[/i]
:End
:Lbl Q
:ClrHome
:Disp "YOUR SCORE:
:Pause S
:ClrHome:"[/goose]
Last edited by Guest on 25 Sep 2010 03:05:34 pm; edited 1 time in total |
|
Back to top |
|
|
spandiv -- Retired --
Active Member
Joined: 25 May 2003 Posts: 650
|
Posted: 11 Sep 2007 12:26:33 am Post subject: |
|
|
Since nobody has replied to my last post with optimizations, I'm going to assume that there are no optimizations to be made. So, let's move on to the next program.
Hangman -- http://www.ticalc.org/archives/files/fileinfo/119/11939.html
Code: [goose]:Lbl AA
:"888888888888888888888888888888888"→Str0
:1→U
:0→R
:While length(Str0)>32
:ClrHome
:Disp "WORD? (32 CHARS)"
:Input "",Str0
:End
:length(Str0)→dim([size=9]L[/size]HANG2)
:length(Str0)→dim([size=9]L[/size]HANG)
:Fill(0,[size=9]L[/size]HANG)
:ClrHome
:Disp "LOADING..."
:For(A,1,length(Str0),1)
:If sub(Str0,A,1)=" ":0→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="A":41→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="B":42→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="C":43→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="D":51→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="E":52→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="F":53→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="G":54→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="H":55→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="I":61→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="J":62→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="K":63→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="L":64→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="M":65→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="N":71→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="O":72→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="P":73→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="Q":74→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="R":75→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="S":81→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="T":82→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="U":83→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="V":84→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="W":85→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="X":91→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="Y":92→[size=9]L[/size]HANG2(A)
:If sub(Str0,A,1)="Z":93→[size=9]L[/size]HANG2(A)
:Output(2,2," "
:Output(2,1,length(Str0)-A)
:End
:ClrHome
:0→X
:1→M:1→N
:For(A,1,length(Str0),1)
:Output(M,N,"-")
:If sub(Str0,A,1)=" ":Output(M,N," ")
:If N=16:Then:0→N:2→M:End
:1+N→N
:End
:For(C,1,length(Str0),1):If [size=9]L[/size]HANG2©=0:Then:0→[size=9]L[/size]HANG©:U+1→U:End:End // © is the Cth element in the list
:Output(7,1,"ABCDEFGHIJKLMNOP QRSTUVWXYZ"
:While X=0
:0→K
:While (K<41 or K>93) and (K≠44 or K≠45)
:getKey→K
:End
:1→F
:0→G
:If K=41:Output(7,1," "
:If K=42:Output(7,2," "
:If K=43:Output(7,3," "
:If K=51:Output(7,4," "
:If K=52:Output(7,5," "
:If K=53:Output(7,6," "
:If K=54:Output(7,7," "
:If K=55:Output(7,8," "
:If K=61:Output(7,9," "
:If K=62:Output(7,10," "
:If K=63:Output(7,11," "
:If K=64:Output(7,12," "
:If K=65:Output(7,13," "
:If K=71:Output(7,14," "
:If K=72:Output(7,15," "
:If K=73:Output(7,16," "
:If K=74:Output(8,4," "
:If K=75:Output(8,5," "
:If K=81:Output(8,6," "
:If K=82:Output(8,7," "
:If K=83:Output(8,8," "
:If K=84:Output(8,9," "
:If K=85:Output(8,10," "
:If K=91:Output(8,11," "
:If K=92:Output(8,12," "
:If K=93:Output(8,13," "
:For(D,1,length(Str0),1):If K=[size=9]L[/size]HANG(D):1→G:End
:If G=1:0→F
:For(A,1,length(Str0),1)
:If K=[size=9]L[/size]HANG2(A) and G=0:Then
:K→[size=9]L[/size]HANG(U)
:U+1→U
:0→F
:int(A/17)+1→P
:If A>16:Then:A-16→Q:Else:A→Q:End
:If K=41:Output(P,Q,"A"
:If K=42:Output(P,Q,"B"
:If K=43:Output(P,Q,"C"
:If K=51:Output(P,Q,"D"
:If K=52:Output(P,Q,"E"
:If K=53:Output(P,Q,"F"
:If K=54:Output(P,Q,"G"
:If K=55:Output(P,Q,"H"
:If K=61:Output(P,Q,"I"
:If K=62:Output(P,Q,"J"
:If K=63:Output(P,Q,"K"
:If K=64:Output(P,Q,"L"
:If K=65:Output(P,Q,"M"
:If K=71:Output(P,Q,"N"
:If K=72:Output(P,Q,"O"
:If K=73:Output(P,Q,"P"
:If K=74:Output(P,Q,"Q"
:If K=75:Output(P,Q,"R"
:If K=81:Output(P,Q,"S"
:If K=82:Output(P,Q,"T"
:If K=83:Output(P,Q,"U"
:If K=84:Output(P,Q,"V"
:If K=85:Output(P,Q,"W"
:If K=91:Output(P,Q,"X"
:If K=92:Output(P,Q,"Y"
:If K=93:Output(P,Q,"Z"
:End
:End
:If sum([size=9]L[/size]HANG)=sum([size=9]L[/size]HANG2):2→X
:If F=1:Then
:1+R→R
:If R=1:Output(3,8,"O"
:If R=2:Output(4,8,"I"
:If R=3:Output(4,7,"-"
:If R=4:Output(4,9,"-"
:If R=5:Output(5,8,"I"
:If R=6:Output(6,7,"^"
:If R=7:Then:Output(6,9,"^":Output(1,1,Str0:For(Q,1,1000,1):End:1→X:End
:End
:End
:Output(1,1,Str0)
:Output(7,1," "
:If X=1:Then
:Output(7,7,"YOU")
:Output(8,7,"LOSE")
:Pause
:Goto ZZ
:End
:If X=2:Then
:Output(7,7,"YOU")
:Output(8,7,"WIN"
:Pause
:Goto ZZ
:End
:Lbl ZZ
:Menu("PLAY AGAIN?","YES",AA,"NO",BB)
:Lbl BB
:ClrHome[/goose]
Last edited by Guest on 25 Sep 2010 03:00:15 pm; edited 1 time in total |
|
Back to top |
|
|
kalan_vod
Advanced Member
Joined: 04 Sep 2005 Posts: 446
|
Posted: 11 Sep 2007 09:55:33 am Post subject: |
|
|
Wow... |
|
Back to top |
|
|
spandiv -- Retired --
Active Member
Joined: 25 May 2003 Posts: 650
|
Posted: 11 Sep 2007 03:04:01 pm Post subject: |
|
|
The saddest thing about the hangman program is that it's author (Ben Ilegbodu) is the same guy who wrote the BASIC Guru tutorials. There's a great irony in him teaching people how to program TI-Basic, when he himself didn't have very good code. |
|
Back to top |
|
|
|