Author |
Message |
|
bananaman Indestructible
Calc Guru
Joined: 12 Sep 2005 Posts: 1124
|
Posted: 09 May 2006 09:16:28 pm Post subject: |
|
|
Here is a quick game I threw together to test my skills at variable manipulation. If you like it or have optimizations please post.
[quote name='"BASIC Code"']:StoreGDB 1
:GridOff
: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
:1→S
:While max(∟C4=0
:1→Z
:While Z
:Repeat max(K=21,105
:If T=2
:Then
:For(I,‾24,‾22
:Line(6S+19,I,6S+21,I
:End
:End
:DelVar ZLine(6S+19,‾21,6S+21,‾21
:Line(6S+18,‾22,6S+18,‾24
:Line(6S+22,‾22,6S+22,‾24
:Line(6S+19,‾25,6S+21,‾25
:0getKey
:Repeat Ans
:getKey→K
:End
:Text(20,6S+18,"
:S-(K=24)+(K=26→S
:S-8(S=9)+8not(S→S
:If K=45
:Then
:Goto 9
:End
:End
:max((0=seq(∟C4(θ),θ,6S-5,6S))(seq(θ,θ,1,6→B
:If not(B
:1→Z
:End
:6S+B-6→D
:T→∟C4(D
:6S+20→P
:‾6B-23→Q
:If T=1
:Then
:Line(P-1,Q-2,P+1,Q-2
:Line(P+2,Q-1,P+2,Q+1
:Line(P-1,Q+2,P+1,Q+2
:Line(P-2,Q-1,P-2,Q+1
:Else
:Line(P-1,Q-2,P+1,Q-2
:For(I,‾1,1
:Line(P-2,Q-I,P+2,Q-I
:End
:Line(P-1,Q+2,P+1,Q+2
: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
:0getKey
:Repeat getKey
:End
:Lbl 9
:RecallGDB 1
:DelVar GDB1ClrHome
:Output(8,4,"CONNECT 4
Generated by SourceCoder, © 2005 Cemetech[/quote]
edit:
Some ? are - signs and some are the list symbol you can easily tell.
Last edited by Guest on 09 May 2006 09:18:37 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: 09 May 2006 09:22:35 pm Post subject: |
|
|
Code: While max(∟C4=0 can change to Code: Repeat max(∟C4
Code: Repeat max(K=21,105 You need a { before 21. Unless the ERR: DATA TYPE is intentional.
Code: :0getKey Huh?
Code: :If K=45
:Then
:Goto 9
:End BAD. Never use Goto in a loop or If-Then statement, it causes memory leak. Just get rid of the :Then and :End in this case.
I can't check it thoroughly right now for the more complicated tricks, but those are the ones I saw in a quick run-through. |
|
Back to top |
|
|
bananaman Indestructible
Calc Guru
Joined: 12 Sep 2005 Posts: 1124
|
Posted: 09 May 2006 09:23:18 pm Post subject: |
|
|
ohh, I think I'm first.
Hey bananaman why don't you replace
If K=45
Then
Goto 9
End
with
If K=25
Goto 9
And Delvar?C4 at the end just to be userfriendly.
Otherwise cool game.
Edit:
Nope second.
Last edited by Guest on 09 May 2006 09:23:51 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: 09 May 2006 09:24:43 pm Post subject: |
|
|
bananaman wrote: ohh, I think I'm first. [post="78775"]<{POST_SNAPBACK}>[/post] Nice try, but nope. :)
And who the h*** are you anyway? :confused: |
|
Back to top |
|
|
bananaman Indestructible
Calc Guru
Joined: 12 Sep 2005 Posts: 1124
|
Posted: 09 May 2006 09:27:01 pm Post subject: |
|
|
alexrudd wrote: Code: Repeat max(K=21,105 You need a { before 21. Unless the ERR: DATA TYPE is intentional.
Code: :0getKey Huh?
[post="78774"]<{POST_SNAPBACK}>[/post]
I have one in my original. Scourcecoder just took it out for some reason.
I believe 0getKey resets getkey so as to make it so it doesn't have the annoying thing where the calculator memorizes one too many getkeys and will do stuff if you double press. I hope I'm clear. |
|
Back to top |
|
|
alexrudd pm me if you read this
Bandwidth Hog
Joined: 06 Oct 2004 Posts: 2335
|
Posted: 09 May 2006 09:28:38 pm Post subject: |
|
|
bananaman wrote: I believe 0getKey resets getkey so as to make it so it doesn't have the annoying thing where the calculator memorizes one too many getkeys and will do stuff if you double press. I hope I'm clear. [post="78777"]<{POST_SNAPBACK}>[/post] Never heard of that one before. Unless I'm mistaken, all 0getKey does is store 0 to Ans.
So you are the 'real' banaman? Then who is the other guy (who posted right after me)? |
|
Back to top |
|
|
bananaman Indestructible
Calc Guru
Joined: 12 Sep 2005 Posts: 1124
|
Posted: 09 May 2006 09:31:31 pm Post subject: |
|
|
It was my alternate personality. I don't know how he grabs ahold of me, but sometimes I can't suppress him.
I saw someone else use 0getKey and figured they must be smart so I used it. I think it clears the getkey. |
|
Back to top |
|
|
c_plus_plus My Face Hertz
Active Member
Joined: 30 Jan 2006 Posts: 575
|
Posted: 09 May 2006 09:31:56 pm Post subject: |
|
|
seems obvious to me: same bananaman. he was being sarcastic. |
|
Back to top |
|
|
Lyricalwolf
Advanced Newbie
Joined: 21 Apr 2006 Posts: 90
|
Posted: 09 May 2006 09:32:42 pm Post subject: |
|
|
I made an awesome Connect-4 game awhile back, too bad i deleted it!.....sigh |
|
Back to top |
|
|
alexrudd pm me if you read this
Bandwidth Hog
Joined: 06 Oct 2004 Posts: 2335
|
Posted: 09 May 2006 09:37:36 pm Post subject: |
|
|
bananaman wrote: It was my alternate personality. I don't know how he grabs ahold of me, but sometimes I can't suppress him.
I saw someone else use 0getKey and figured they must be smart so I used it. I think it clears the getkey. [post="78779"]<{POST_SNAPBACK}>[/post] OK, it's just that I remember an incident or two where members got matched to the wrong posts, a long time ago.
getKey clears the keys just as well as 0getKey, but I don't think you need it anyway. Unless you want to clear out any keys the player may have pressed before testing it. If you do that though, it may lose some keypresses if the player has fast reaction times. |
|
Back to top |
|
|
c_plus_plus My Face Hertz
Active Member
Joined: 30 Jan 2006 Posts: 575
|
Posted: 09 May 2006 09:38:55 pm Post subject: |
|
|
who is this other programer who used thie. ide. what game? |
|
Back to top |
|
|
bananaman Indestructible
Calc Guru
Joined: 12 Sep 2005 Posts: 1124
|
Posted: 09 May 2006 09:42:39 pm Post subject: |
|
|
alexrudd wrote: getKey clears the keys just as well as 0getKey, but I don't think you need it anyway. Unless you want to clear out any keys the player may have pressed before testing it. If you do that though, it may lose some keypresses if the player has fast reaction times.
[post="78783"]<{POST_SNAPBACK}>[/post]
My goal is to get rid of extra keypresses so you don't interfere with the other persons turn.
c_plus_plus wrote: who is this other programer who used thie. ide. what game?
[post="78784"]<{POST_SNAPBACK}>[/post]
I actually forget. It might have been Kevin Ouellette, but I have no real clue at all.
Last edited by Guest on 09 May 2006 09:43:14 pm; edited 1 time in total |
|
Back to top |
|
|
|