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-BASIC 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. TI-Basic => TI-BASIC
United-TI Archives -> TI-Basic
 
    » Goto page Previous  1, 2, 3, 4, 5, 6  Next
» View previous topic :: View next topic  
Author Message
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 20 Sep 2007 05:44:47 pm    Post subject:

Repeat K=105 or K=21
Text(18,70,θ
getKey→K
If K=24 and θ>10:θ-10→θ
If K=26 and θ<90:θ+10→θ
End


can be changed to:
Repeat Ans=80 or not(Ans
Text(18,70,θ
getKey-25
If 1=abs(ans
max(1,min(9,θ+Ans→θ
End

and then change the "If K=21" to "If Ans=-4"

The first part with the Pxl-On('s can be changed to
W-6X→B
Pxl-On(20,B-4X
Pxl-On(14,B-2X
Pxl-On(15,B-3X
Pxl-On(15,B-X
Pxl-On(16,B
Pxl-On(18,B
Pxl-On(20,B
Pxl-On(21,B-X
Pxl-On(21,B-2X
Pxl-On(21,B-3X
Pxl-On(21,B-X #This one's repeated, so I'm not sure if it's a typo or an accidental extra
Pxl-On(19,B-X
Pxl-On(17,B-X

if you change the possible values of X from 1 and 2, to -1 and 1 (the 2 becomes -1)

The other long bunch of Pxl-On's (and a Pxl-Off( )
Pxl-Off(16,B
Pxl-On(15,B
Pxl-On(17,B
Pxl-On(15,B+X
Pxl-On(17,B+X
Pxl-On(15,B+2X
Pxl-On(17,B+2X
Pxl-On(16,B+3X


some other optimizations:
For(D,W,(W+(C*3))-Y*6,2
becomes For(D,W,W+3C-6Y,2

round(rand*2,0)+1→Y
becomes randInt(1,3→Y
unless he has uneven probabilities for a reason

I found a bunch more but I'm still trying to decipher my handwriting...


Last edited by Guest on 23 Sep 2010 11:36:15 pm; edited 1 time in total
Back to top
spandiv
-- Retired --


Active Member


Joined: 25 May 2003
Posts: 650

Posted: 21 Sep 2007 08:03:57 pm    Post subject:

Tonight, I finally got around to finishing the reorganization of the Football game, and it now has zero branching. I also decided to remove the author credits, and for fun replaced the user menu flicks selection with just a random number of flicks :) Anyway, here is what the game currently looks like (Note: the rand(# commands are specific to my calculator, so you might want to change/remove them when trying the game on your calculator):


Code:
[goose]:ClrHome
:Full
:FnOff
:AxesOff
:ZStandard
:Line(-9,10,-9,0
:Line(9,10,9,0
:Line(9,8,9,2,0
:Line(-9,8,-9,2,0
:Line(7,10,7,0
:Line(-7,10,-7,0
:Line(7,8,7,2,0
:Line(-7,8,-7,2,0
:Line(-10,10,-10,-10
:Line(-10,-10,10,-10
:Line(10,-10,10,10
:Line(10,10,-10,10
:Line(10,10,10,-10
:Line(-10,0,10,0
:Line(.5,0,.5,-10
:Line(-.5,0,-.5,-10
:DelVar SDelVar T
:1-2int(2rand→X
:17+60(Ans<1→W
:1+int(3rand→Y
:Text(33,4,"PLAYER = 1
:Text(47,4,"PLAYER = 2
:Text(33,55,"CONDITION
:Text(39,66,sub("ICE   ROCKY NORMAL",6Ans-5,6
:Text(47,53,"FLICKS LEFT
:Text(53,56,"FLICKS=
:Text(39,6,"SCORE=
:Text(53,6,"SCORE=
:For(θ,10int(9rand+1),1,-1
:Text(39,30,S
:Text(53,30,T
:Text(53,84," (8 spaces)
:Text(53,84,θ
:For(M,32,61,6
:Text(M,47," (1 space)
:End
:W-6X→B
:Pxl-On(20,B-4X
:Pxl-On(14,B-2X
:Pxl-On(15,B-3X
:Pxl-On(15,B-X
:Pxl-On(16,B
:Pxl-On(18,B
:Pxl-On(20,B
:Pxl-On(21,B-X
:Pxl-On(21,B-2X
:Pxl-On(21,B-3X
:Pxl-On(19,B-X
:Pxl-On(17,B-X
:Text(13,W-1,"0
:61→C:1→E
:Repeat getKey=105
:E(C≥32 and C≤61)+(C=32)-(C=61→E
:C+Ans→C
:Pxl-Change(Ans,47
:End
:DelVar A62-Ans→C
:Pxl-Off(16,B
:Pxl-On(15,B
:Pxl-On(17,B
:Pxl-On(15,B+X
:Pxl-On(17,B+X
:Pxl-On(15,B+2X
:Pxl-On(17,B+2X
:Pxl-On(16,B+3X
:W+3CX-6YX
:For(D,W,Ans,2X
:Text(13,D-1,"0
:If dim(rand(2
:Text(13,D-1," (3 spaces)
:If D<5 or D>89
:Ans+1→D
:End
:Text(14,W+3-13(X=1)," (8 spaces)
:Text(16,W+3-13(X=1)," (8 spaces)
:If D<5 or D>89:Then
:Text(13,25,"IT'S WAY PAST!
:rand(50
:For(M,25,68,3
:Text(13,M," (3 spaces)
:End
:1→A
:End
:If D≥5 and D≤13 or D≥80 and D≤88
:Then
:Text(15,28,"TOUCHDOWN!
:rand(50
:For(M,28,64,3
:Text(15,M," (3 spaces)
:End
:Text(14,D-1," (4 spaces)
:S+6(X=1→S
:Text(39,30,Ans
:T+6(X<1→T
:Text(53,30,Ans
:Line(-1,9,-1,7
:Line(1,9,1,7
:36→C:1→E
:Repeat getKey=105
:E(C≥36 and C≤56)+(C=35)-(C=57→E
:C+Ans→C
:Text(22,Ans,"0
:Text(22,Ans-4E," (4 spaces)
:End
:For(N,16,4,-6
:Text(N,C,"0
:rand(2
:Text(N+6,C," (4 spaces)
:End
:If C≥44 and C≤48:Then
:Text(22,32,"IT'S GOOD!
:rand(50
:For(N,32,62,3
:Text(22,N," (3 spaces)
:End
:S+(X=1→S
:Text(39,30,Ans
:T+(X<1→T
:Text(53,30,Ans
:End
:Line(-1,9,-1,7,0
:Line(1,9,1,7,0
:Text(4,C," (3 spaces)
:1→A
:End
:-X→X
:D
:If A
:17+60(X<1
:Ans→W
:End
:Text(10,29,"GAME OVER!
:"IT'S A TIE GAME!
:If S≠T
:"PLAYER-"+sub("12",1+(S<T),1)+" WINS!
:Text(16,22,Ans
:Pause
:ClrDraw
:ClrHome:"[/goose]


Last edited by Guest on 23 Sep 2010 11:36:34 pm; edited 1 time in total
Back to top
Delnar_Ersike
Lazy H4xx0r


Active Member


Joined: 24 Dec 2006
Posts: 578

Posted: 21 Sep 2007 11:34:55 pm    Post subject:

I still think those Pxl-On's can be optimized somehow. This rearrangement of the Pxl-On's might help in future optimizations:

:Pxl-On(14,B-2X
:Pxl-On(15,B-3X
:Pxl-On(15,B-X
:Pxl-On(16,B
:Pxl-On(17,B-X
:Pxl-On(18,B
:Pxl-On(19,B-X
:Pxl-On(20,B
:Pxl-On(20,B-4X
:Pxl-On(21,B-X
:Pxl-On(21,B-2X
:Pxl-On(21,B-3X


:Pxl-On(15,B
:Pxl-On(15,B+X
:Pxl-On(15,B+2X
:Pxl-On(16,B+3X
:Pxl-On(17,B
:Pxl-On(17,B+X
:Pxl-On(17,B+2X


Last edited by Guest on 23 Sep 2010 11:36:52 pm; edited 1 time in total
Back to top
spandiv
-- Retired --


Active Member


Joined: 25 May 2003
Posts: 650

Posted: 22 Sep 2007 12:30:52 am    Post subject:

The two ways you can optimize the Pxl-On( commands are by either replacing some of them with a couple Line( commands or coming up with an equivalent text-sprite.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 22 Sep 2007 12:40:56 am    Post subject:

ZStandard
10
Line(-9,Ans,-9,0



Last edited by Guest on 23 Sep 2010 11:37:06 pm; edited 1 time in total
Back to top
spandiv
-- Retired --


Active Member


Joined: 25 May 2003
Posts: 650

Posted: 22 Sep 2007 01:23:17 am    Post subject:

Weregoose wrote:
ZStandard
10
Line(-9,Ans,-9,0

Thanks for reminding me :)

You can replace this
:Line(-10,10,-10,-10
:Line(-10,-10,10,-10
:Line(10,-10,10,10
:Line(10,10,-10,10
:Line(10,10,10,-10
:Line(-10,0,10,0

with this
:Horizontal Xmin
:Horizontal Xmax
:Horizontal .5ΔX
:Vertical Ymin
:Vertical Ymax

EDIT: I just noticed one small mistake in the Football program's code that I posted. In the lines of code that consist of If D<5 or D>89, the 89 should be an 88. This fixes the domain error that can occur if D is exactly 89.


Last edited by Guest on 23 Sep 2010 11:37:47 pm; edited 1 time in total
Back to top
spandiv
-- Retired --


Active Member


Joined: 25 May 2003
Posts: 650

Posted: 22 Sep 2007 10:23:11 pm    Post subject:

Well, I think the Football program is pretty optimized, so we can move on to another program. Unlike the last three programs which needed major restructuring, this next program already has pretty good structure, which will allow us to just concentrate on optimizing it.

Connect 4 -- http://www.ticalc.org/archives/files/fileinfo/361/36169.html


Code:
[goose]:StoreGDB 1
:AxesOff
:FnOff
:0→Xmin
:94→Xmax
:-62→Ymin
:0→Ymax
:48→dim(∟C4
:Fill(0,∟C4
:ClrDraw
:Text(0,10,"CONNECT 4:JOSEPH ROTH
:For(I,23,71,6
:Line(I,-26,I,-62
:End
:For(I,-62,-26,6
:Line(23,I,71,I
:End
:Horizontal -7
:1→T
:Ans→S
:Repeat min(∟C4
:1→Z
:While Z
:Repeat max(K={21,105
:6S+18→θ
:If T=2
:Then
:For(I,-24,-22
:Line(θ+1,I,θ+3,I
:End
:End
:DelVar ZLine(θ+1,-21,θ+3,-21
:Line(θ,-22,θ,-24
:Line(θ+4,-22,θ+4,-24
:Line(θ+1,-25,θ+3,-25
:getKey
:Repeat Ans
:getKey→K
:End
:Text(20,θ,"     
:S-(K=24)+(K=26→S
:S-8(S=9)+8not(S→S
:If K=45
:Goto 9
:End
:max((seq(θ,θ,1,6)(0=seq(∟C4(θ),θ,6S-5,6S→B
:If not(B
:1→Z
:End
:T→∟C4(6S+B-6
:θ+1→P
:-6B-25→Q
:If T=1
:Then
:Line(P,Q,P+2,Q
:Line(P+3,Q+1,P+3,Q+3
:Line(P,Q+4,P+2,Q+4
:Line(P-1,Q+1,P-1,Q+3
:Else
:Line(P,Q,P+2,Q
:For(I,1,3
:Line(P-1,Q+I,P+3,Q+I
:End
:Line(P,Q+4,P+2,Q+4
:End
:S→O
:Ans→M
:For(N,S,8
:If N=O and T=∟C4(6N+B-6
:O+1→O
:End
:For(N,S,1,-1
:If N=M and T=∟C4(6M+B-6
:M-1→M
:End
:If O-M>4
:Fill(T,∟C4
:B→O
:For(N,B,6
:If N=O and T=∟C4(6S+N-6
:O+1→O
:End
:If O-B>3
:Fill(T,∟C4
:For(I,-1,1,2
:B→M
:S→O
:Ans→N
:While M<7 and O<9 and O=N and M>0
:If T=∟C4(6O+M-6
:N+1→N
:M+I→M
:O+1→O
:End
:B→M
:S→O
:Ans→J
:While M>0 and O>0 and J=O and M<7
:If T=∟C4(6O+M-6
:J-1→J
:M-I→M
:O-1→O
:End
:If N-J>4
:Fill(T,∟C4
:End
:-T+3→T
:End
:Text(15,30,sub("BLACKWHITE",5T-4,5)," WINS
:getKey
:Repeat getKey
:End
:Lbl 9
:RecallGDB 1
:DelVar GDB1DelVar ∟C4ClrHome[/goose]


Last edited by Guest on 23 Sep 2010 11:38:05 pm; edited 1 time in total
Back to top
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 22 Sep 2007 11:34:53 pm    Post subject:

48→dim(∟C4
Fill(0,∟C4

can be 0binomcdf(47,0→C4

The whole 1→Z:While Z ... If not(B:1→Z
can be Repeat not(B ... End and you can eliminate the Delvar Z, and the 1→Z before the loop starts

max((seq(θ,θ,1,6)(0=seq(∟C4(θ),θ,6S-5,6S→B
becomes max(cumsum(binomcdf(5,0)sum(not(∟C4),6S-5,6S→B

If T=1
Then
Line(P,Q,P+2,Q
Line(P+3,Q+1,P+3,Q+3
Line(P,Q+4,P+2,Q+4
Line(P-1,Q+1,P-1,Q+3
Else
Line(P,Q,P+2,Q
For(I,1,3
Line(P-1,Q+I,P+3,Q+I
End
Line(P,Q+4,P+2,Q+4
End

can be
Line(P,Q,P+2,Q
Line(P,Q+4,P+2,Q+4
For(I,P-1,P+3,4
Line(I,Q+1,I,Q+3
End
Else
For(I,Q+1,Q+3
Line(P-1,I,P+3,I
End
End


Last edited by Guest on 23 Sep 2010 11:38:24 pm; edited 1 time in total
Back to top
spandiv
-- Retired --


Active Member


Joined: 25 May 2003
Posts: 650

Posted: 23 Sep 2007 01:51:44 am    Post subject:

Before I forget, the most recent version of the Football program is attached to this post. Here are the optimization results for the program:

Original: 2739 bytes
New: 1380 bytes
Saved: 1359 bytes (49.6% of program removed)
Back to top
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 23 Sep 2007 01:35:07 pm    Post subject:

I just thought of something. Since this topic is getting kind of long and we've already done a few programs, could we make a pinned topic that had the new and original versions and the stats of what we did to them? Since this topic is 3 (almost 4) pages and getting longer, compiling everything into one topic would make it easier to find and keep track of what we've done.

Last edited by Guest on 23 Sep 2007 01:35:51 pm; edited 1 time in total
Back to top
spandiv
-- Retired --


Active Member


Joined: 25 May 2003
Posts: 650

Posted: 23 Sep 2007 02:38:16 pm    Post subject:

simplethinker wrote:
I just thought of something.  Since this topic is getting kind of long and we've already done a few programs, could we make a pinned topic that had the new and original versions and the stats of what we did to them?  Since this topic is 3 (almost 4) pages and getting longer, compiling everything into one topic would make it easier to find and keep track of what we've done.
I would have done that with my first post in this topic, but I'm presently not able to edit my posts after a certain time. If you want to go down the route of creating a new topic, I think it would make sense to give each program it's own post and only have the program posts in the topic (see the TI-Basic Routines List topic for an example of what I'm talking about). You would have to talk to an administrator, though, to get an okay for the double posting.
Back to top
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 23 Sep 2007 02:44:09 pm    Post subject:

Yeah, I was intending to do different posts for the games. I'll PM an administrator and then once I get the OK I'll post it.
Back to top
alexrudd
pm me if you read this


Bandwidth Hog


Joined: 06 Oct 2004
Posts: 2335

Posted: 23 Sep 2007 04:53:47 pm    Post subject:

simplethinker wrote:
48→dim(∟C4
Fill(0,∟C4

can be 0binomcdf(47,0→C4 [post="113051"]<{POST_SNAPBACK}>[/post]
There's no need to overcomplicate things, especially when dealing with potential explosives.
0rand(47→C4

Why haven't I thought of this before?


Last edited by Guest on 23 Sep 2010 11:38:49 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 23 Sep 2007 04:59:41 pm    Post subject:

That's slightly shorter, but also takes over a second to run. I don't think the size difference is worth the major decrease in speed.

Last edited by Guest on 23 Sep 2007 05:00:04 pm; edited 1 time in total
Back to top
spandiv
-- Retired --


Active Member


Joined: 25 May 2003
Posts: 650

Posted: 23 Sep 2007 11:14:35 pm    Post subject:

:0→Xmin:94→Xmax
:-62→Ymin:0→Ymax

can be
:0→Xmin:1→ΔX
:-62→Ymin:1→ΔY


:For(I,23,71,6
:Line(I,-26,I,-62
:End
:For(I,-62,-26,6
:Line(23,I,71,I
:End

can be
:For(I,23,71,6
:Line(I,-26,I,-62
:Line(23,-I-3,71,-I-3
:End


:S-(K=24)+(K=26→S
:S-8(S=9)+8not(S→S

can be
:S-(Ans=24)+(Ans=26
:Ans+8(not(Ans)-(Ans=9→S


The getKey before the two Repeat loops is superfluous, so you can remove it.


Last edited by Guest on 23 Sep 2010 11:39:15 pm; edited 1 time in total
Back to top
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 06 Oct 2007 09:39:01 pm    Post subject:

Since this topic hasn't been posted in for a while, how about a new game
Pong-http://www.ticalc.org/archives/files/fileinfo/202/20240.html


Code:
[goose]::"PONG2.0 BY aA
:Lbl GP
:ClrHome
:Menu("PLAYERS?","ONE",1P,"TWO",2P,"EXIT",E
:Lbl E
:Stop
:Lbl 1P
:1→X
:1→L
:0→Z
:randInt(2,7→A
:16→B
:0→C
:0→S
:0→D
:While 1
:S+1→S
:If S=55L
:L+1→L
:getKey→K
:If K=25 and X≠1:X-1→X
:If K=34 and X≠8:X+1→X
:ClrHome
:If X<7 and A<7
:Output(8,1,"aAPONG
:Output(X,1,"[
:If D=1:A-1→A
:If D=0:A+1→A
:If A=1:0→D
:If A=8:1→D
:If C=0:B-1→B
:Output(A,B,"O
:Output(A,16,"]
:For(θ,1,70-S/3
:End
:getKey→J
:If J>0
:Then
:If J=25 and X≠1:Then
:Output(X,1,"
:X-1→X
:End
:If J=34 and X≠8:Then
:Output(X,1,"
:X+1→X
:End
:Output(X,1,"[
:End
:If B=2 and X=A
:1→C
:If B=2 and X≠A
:Goto F
:If B=15:0→C
:If C=1:B+1→B
:If 100-L2<0
:Goto W
:If J=105 or K=105
:Then
:Output(4,6,"PAUSED
:Output(1,1,"SCORE:
:Output(1,7,S
:Pause
:End
:End
:Lbl F
:ClrHome
:Disp "YOU LOSE","SCORE:
:Output(2,7,S
:Stop
:Lbl W
:ClrHome
:Disp "YOU WIN!!!","SCORE:
:Output(2,7,S
:Stop
:Lbl 2P
:1→L2(1
:1→L2(2
:15→B
:0→C
:1→L
:1→A
:0→D
:0→L1(1
:0→L1(2
:While 1
:L1(1)+1→L1(1
:L1(2)+1→L1(2
:If S=55L:L+1→L
:getKey→K
:If K=21 and L2(1)≠1
:L2(1)-1→L2(1
:If K=41 and L2(1)≠8
:L2(1)+1→L2(1
:If K=25 and L2(2)≠1
:L2(2)-1→L2(2
:If K=34 and L2(2)≠8
:L2(2)+1→L2(2
:ClrHome
:If L2(1)<7 and A<7
:Output(8,1,"aAPONG
:Output(L2(1),1,"[
:Output(L2(2),16,"]
:If D=1:A-1→A
:If D=0:A+1→A
:If A=1:0→D
:If A=8:1→D
:If C=0:B-1→B
:Output(A,B,"O
:For(θ,1,70-S/3
:End
:getKey→J
:If J>0
:Then
:If J=25 and L2(2)≠1
:L2(2)-1→L2(2
:If J=34 and L2(2)≠8
:L2(2)+1→L2(2
:If J=21 and L2(1)≠1
:L2(1)-1→L2(1
:If J=41 and L2(1)≠8
:L2(1)+1→L2(1
:Output(L2(1),1,"[
:Output(L2(2),16,"]
:End
:If B=2 and L2(1)=A
:Then
:1→C
:L1(1)+10→L1(1)
:End
:If B=2 and L2(1)≠A
:Goto PW
:If B=15 and L2(2)=A
:Then
:0→C
:L1(2)+10→L1(2
:End
:If B=15 and L2(2)≠A
:Goto PX
:If C=1:B+1→B
:If J=105 or K=105
:Then
:Output(4,6,"PAUSED
:Output(1,1,"P1:
:Output(2,1,"P2:
:Output(1,4,L1(1
:Output(2,4,L1(2
:Pause
:End
:End
:Lbl PX
:ClrHome
:Disp "P1 WINS","P1:",L1(1)+112,"P2:",L1(2)
:Pause
:Goto GP
:Lbl PW
:ClrHome
:Disp "P2 WINS","P1:",L1(1),"P2:",L1(2)+112
:Pause
:Goto GP[/goose]


Last edited by Guest on 23 Sep 2010 11:39:42 pm; edited 1 time in total
Back to top
TheStorm


Calc Guru


Joined: 17 Apr 2007
Posts: 1233

Posted: 06 Oct 2007 11:18:06 pm    Post subject:

wholy crap are telling me that some one made pong and it is that long. lol That is sad, we should just remake it.
Back to top
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 06 Oct 2007 11:33:00 pm    Post subject:

TheStorm wrote:
wholy crap are telling me that some one made pong and it is that long. lol That is sad, we should just remake it.
[post="114007"]<{POST_SNAPBACK}>[/post]

that takes the fun out of it Sad
It's the "best game of pong out there", we shouldn't have to optimize much...lol
A pong game that was 1.4kb and said it was the best, I couldn't resist putting it up here. But yeah, it does need to be rewritten.
Back to top
spandiv
-- Retired --


Active Member


Joined: 25 May 2003
Posts: 650

Posted: 07 Oct 2007 04:14:35 pm    Post subject:

I just haphazardly optimized the 1P part of the game, since I didn't have the stomach to optimize the rest.
Pong is a pretty simple game by its nature, and yet they found a way to complicate it... who knew :D

:Lbl GP
:ClrHome
:Disp "PLAYERS? (1/2)
:Repeat Ans=1 or Ans=2
:getKey-91
:End
:If Ans=2:Goto 2P
:1→X:1→L:16→B
:randInt(2,7→A
:DelVar ZDelVar CDelVar SDelVar D
:Repeat B=2 and X≠A or 100<L2
:ClrHome
:S+1→S
:L+(S=55L→L
:Output(X,1,"[
:A-D+not(D→A
:B-not(C→B
:If A=1 or A=8
:not(D→D
:Output(A,B,"O
:Output(A,16,"]
:rand(70-S
:getKey→J
:If J=105:Pause "PAUSED
:If J:Then
:Output(X,1,"
:max(1,min(8,X+(Ans=34)-(Ans=25→X
:Output(X,1,"[
:End
:If B=2 and X=A
:1→C
:If B=15:0→C
:B+C→B
:End
:ClrHome
:Disp "YOU "+sub("LOSE!WIN! ",1+5(100<L2),5),"SCORE:
:Pause S
:Stop


Last edited by Guest on 23 Sep 2010 11:40:00 pm; edited 1 time in total
Back to top
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 08 Oct 2007 08:25:48 am    Post subject:

I completely rewrote the entire thing.
Since the only difference between 1-player and 2-player is what controls the movement of the paddle on the right, I used 'u' for pseudo-SMC to combine the two.

Now for some things I'm not sure of:
I still don't understand the point of
:For(θ,1,70-S/3
:End

It looks like it's supposed to get faster and faster, but I don't notice a difference.

I think that you win when L=10, which ruins the re-playability because it will always cuts you off.

I'm not sure if the scoring for 2-player goes up by 10 every time they hit the ball or something else.

My version doesn't keep score, automatically stop after a set amount of iterations or speed-up. I'm leaving those to other people because (1) Someone else who understands the scoring will do a better job, and (2) I'm lazy.
Here's my rewrite:
ClrHome
Disp "WHAT?","1:SOLO","2:BATTLE
Repeat Ans=1 or Ans=2
getKey-91→ P
End
If P=1:"4,C}-{Ans=25,0
If P=2:"1,Ans=34}-(Ans={21,25
"{Ans=3"+Ans→u
4→A
1→C
2→B
1→D
{4,4→L1
Repeat K=45 or B=1 or B=16
ClrHome
Output(L1(1),1,"[
Output(L1(2),16,"]
Output(A,B,"O
getKey→K
max(1,min(8,L1+u→L1
If K=105
Then
Repeat getKey
End
End
A+C→A
If Ans=1 or Ans=8
-C→C
B+D→B
If max(A=L1 and Ans={2,15
-D→D
End


Variables:
P=number of players
u=dictates how the right-paddle will be controlled
A=vertical position of the ball
B=horizontal position of the ball
C=vertical direction of the ball
D=horizontal direction of the ball
L1={position of P1,position of P2/computer}
K=getKey value


Last edited by Guest on 23 Sep 2010 11:35:46 pm; edited 1 time in total
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
    » Goto page Previous  1, 2, 3, 4, 5, 6  Next
» View previous topic :: View next topic  
Page 3 of 6 » All times are UTC - 5 Hours

 

Advertisement