I am currently planning to expand the game. I optimized some of the things in the code (extra quotation marks, parenthesis, etc.). Can this be optimized any further?
Code:
Code:
:"CONNECT 4 By Scode
ClrDraw
1→Xmin:1→Ymin
95→Xmax:63→Ymax:AxesOff
Text(0,56,"CONNECT 4
Text(14,50,"WELCOME TO
Text(20,50,"CONNECT 4.
Text(26,50,"PLEASE SEE
Text(32,50,"WWW.SICODE.
Text(38,50,"TICALC.ORG
Text(44,50,"FOR A+ GAMES
Text(57,60,"SC°D
For(F,1,9
Line(1,65-F*8,49,65-F*8
Line(F*6-5,57,F*6-5,1
End
" →Str1
Text(0,2,"V
8→dim(L₁
Fill(9,L₁
{11,12→dim([A]
Fill(0,[A]
{11,12→dim([B]
Fill(0,[B]
8→dim(L₂
1→D:1→X
0→K:0→G
int(rand*3→H
If H=1:1.5→H
int(rand*2)/10→A
If rand<.5
Goto D
Lbl T
Lbl B
getKey
Text(0,0,Str1+"
Lbl BB
Text(0,(X+D)*6+2,"V
getKey→K
If Ans:Then
Text(0,(X+D)*6+2,"
max(1,min(8,D+(K=26)-(K=24→D
End
If K≠21 and K≠105
Goto BB
If 2=L₁(D
Goto BB
Text(0,(X+D)*6+2,"V
L₁(D→R
Line((D+X)*6+4,66-(L₁(D)-1)*8,(D+X)*6+2,68-(L₁(D)-1)*8
Line((D+X)*6+4,66-(L₁(D)-1)*8,(D+X)*6+6,68-(L₁(D)-1)*8
Line((D+X)*6+4,72-(L₁(D)-1)*8,(D+X)*6+2,70-(L₁(D)-1)*8
Line((D+X)*6+4,72-(L₁(D)-1)*8,(D+X)*6+6,70-(L₁(D)-1)*8
1→[B](R,D+2
0→Q
1→P:D→B
If rand>.6
Goto S
Lbl V
Text(0,0,"I'M THINKING...
Lbl C
B+2→C
0→I
While P=[B](R,C
I+1→I:C+1→C
End
C→Y:C+1→C
0→L
While P=[B](R,C
L+1→L
C+1→C
End
B+2→C
0→J
While P=[B](R,C
J+1→J:C-1→C
End
C→Z
C-1→C
0→O
While P=[B](R,C
O+1→O:C-1→C
End
If I+J≥5
Goto DD
I+J+L-1+A→N
I+J+O-1+A→O
If N>3:3→N
If O>3:3→O
If N+Q>[A](R,Y
N+Q→[A](R,Y
If O+Q>[A](R,Z
O+Q→[A](R,Z
B+2→C
0→I:R→E
While P=[B](R,C
I+1→I:R+1→R
End
0→J
E→R
While P=[B](R,C
J+1→J:R-1→R
End
If I+J≥5
Goto DD
I+J-1→N
If N>3
3→N
If N+Q>[A](R,C
N+Q→[A](R,C
E→R
B+2→C
0→I:R→E
While P=[B](R,C
I+1→I
R+1→R:C+1→C
End
C→Y:R→W
C+1→C:R+1→R
0→L
While P=[B](R,C
L+1→L:R+1→R
C+1→C:End
B+2→C
0→J
E→R
While P=[B](R,C
J+1→J:R-1→R
C-1→C:End
C→Z:R→K
C-1→C:R-1→R
0→O
While P=[B](R,C
O+1→O:R-1→R
C-1→C:End
If I+J≥5
Goto DD
I+J+L-1→N
I+J+O-1→O
If N>3:3→N
If O>3:3→O
If N+Q>[A](W,Y
N+Q→[A](W,Y
If O+Q>[A](K,Z
O+Q→[A](K,Z
E→R
B+2→C
0→I:R→E
While P=[B](R,C
I+1→I:R-1→R
C+1→C:End
C→Y:R→W
C+1→C:R-1→R
0→L
While P=[B](R,C
L+1→L:R-1→R
C+1→C:End
B+2→C
0→J:E→R
While P=[B](R,C
J+1→J:R+1→R
C-1→C:End
C→Z:R→K
C-1→C:R+1→R
0→O
While P=[B](R,C
O+1→O:R+1→R
C-1→C:End
If I+J≥5
Goto DD
I+J+L-1→N
I+J+O-1→O
If N>3:3→N
If O>3:3→O
If N+Q>[A](W,Y
N+Q→[A](W,Y
If O+Q>[A](K,Z
O+Q→[A](K,Z
E→R:G+1→G
If G=56:3→P
If G=56
Goto DD
L₁(B)-1→L₁(B
If Q=.5:Goto T
Lbl D
1→Z
For(F,1,8
If 2≠L₁(F
Then
[A](L₁(F),F+2→S
If S≥Z
Then
If [A](L₁(F)-1,F+2)≥3 and S<3 and not(fPart([A](L₁(F)-1,F+2
.5→S
If [A](L₁(F)-1,F+2)≥3.5 and S<3 and .5=fPart([A](L₁(F)-1,F+2
.1→S
If S>Z
Then
S→Z:1→U
F→L₂(U:End
If S=Z
Then
U+1→U:F→L₂(U
End:End:End
End
L₂(int(rand*U)+1→B
2→P:.5→Q
Text((L₁(B)-1)*8-9,(X+B)*6+2,"O
Line((X+B)*6+4,66-(L₁(B)-1)*8,(X+B)*6+4,72-(L₁(B)-1)*8
Line((X+B)*6+2,68-(L₁(B)-1)*8,(X+B)*6+2,70-(L₁(B)-1)*8
Line((X+B)*6+6,68-(L₁(B)-1)*8,(X+B)*6+6,70-(L₁(B)-1)*8
2→[B](L₁(B),B+2
L₁(B→R
Goto C
Lbl DD
If P=3
Text(0,0,"---TIE GAME---
If P=2
Text(0,0,"--COMP WINS!--
If P=1
Text(0,0,"---YOU WIN!---
Pause
ClrHome
Disp "SC°D"
Stop
Lbl S
int(rand*12)+1→F
If F=1
Then
Text(14,50,"WE DON'T NEED"+Str1
Text(20,50,"NO EDUCATION,"+Str1
Text(26,50,"WE DON'T NEED"+Str1
Text(32,50,"NO THOUGHT"+Str1
Text(38,50,"CONTROL."+Str1
Text(44,50,"-PINK FLOYD"+Str1
End
If F=2
Then
Text(14,50,"THE ONLY"+Str1
Text(20,50,"THING YOU"+Str1
Text(26,50,"HAVE TO DO IS"+Str1
Text(32,50,"DIE. THE ONLY"+Str1
Text(38,50,"THING I HAVE"+Str1
Text(44,50,"TO IS MATH."+Str1
End
If F=3
Then
Text(14,50,"YOU ARE"+Str1
Text(20,50,"CARBON"+Str1
Text(26,50,"BASED LIFE."+Str1
Text(32,50,"I AM"+Str1
Text(38,50,"SILICON"+Str1
Text(44,50,"BASED LIFE"+Str1
End
If F=4
Then
Text(14,50,"MY LUCKY"+Str1
Text(20,50,"NUMBER IS 4A."+Str1
Text(26,50,"MY SOCIAL"+Str1
Text(32,50,"SECURITY"+Str1
Text(38,50,"NUMBER"+Str1
Text(44,50,"IS 2(X+3Y)."+Str1
End
If F=5
Then
Text(14,50,"HOW CAN YOU"+Str1
Text(20,50,"FEEL GOOD IF"+Str1
Text(26,50,"YOU NEVER"+Str1
Text(32,50,"FELT BAD."+Str1
Text(38,50,"YOU CAN'T."+Str1
Text(44,50,"ONLY I CAN."+Str1
End
If F=6
Then
Text(14,50,"T.I. CALCS ARE"+Str1
Text(20,50,"GOING TO"+Str1
Text(26,50,"TAKE OVER"+Str1
Text(32,50,"THE WORLD!"+Str1
Text(38,50,"OF LINEAR"+Str1
Text(44,50,"EQUATIONS."+Str1
End
If F=7
Then
Text(14,50,"GOD CREATED"+Str1
Text(20,50,"MAN. MAN"+Str1
Text(26,50,"CREATED CALC"+Str1
Text(32,50,"CALC CREATED"+Str1
Text(38,50,"NUMBERS."+Str1
Text(44,50,"WOOPTIE DOO"+Str1
End
If F=8
Then
Text(14,50,"BUDDA IS ON"+Str1
Text(20,50,"ZEUS'S SIDE."+Str1
Text(26,50,"ZEUS IS ON"+Str1
Text(32,50,"GOD'S SIDE."+Str1
Text(38,50,"GOD IS ON"+Str1
Text(44,50,"MY SIDE. HAHA"+Str1
End
If F=9
Then
Text(14,50,"IN JAIL, YOU"+Str1
Text(20,50,"COULD PLAY"+Str1
Text(26,50,"ME ALL DAY"+Str1
Text(32,50,"LONG. WON'T"+Str1
Text(38,50,"THAT BE A"+Str1
Text(44,50,"BLAST!"+Str1
End
If F=10
Then
Text(14,50,"YO HABLO"+Str1
Text(20,50,"ESPANOL. YO"+Str1
Text(26,50,"TENGO DOS"+Str1
Text(32,50,"HERMANOS."+Str1
Text(38,50,"YO SABO POCO"+Str1
Text(44,50,"ESPANOL."+Str1
End
If F>10
Then
Text(14,50,Str1
Text(20,50,Str1
Text(26,50,Str1
Text(32,50,Str1
Text(38,50,Str1
Text(44,50,Str1
End
Goto V