-
Notifications
You must be signed in to change notification settings - Fork 1
/
connect4.txt
8 lines (8 loc) · 1.43 KB
/
connect4.txt
1
2
3
4
5
6
7
8
0 DIM F$(10),FC$(9),P(8),G(8,10):T=1:GRAPHICS 7:F=ADR(F$):FC=ADR(FC$):FC$="{ATASCII stuff}":PRINT "Welcome to Connect 4":A=PEEK(106)-32:POKE 54279,A:PM=256*A:POKE 559,46:POKE 53277,3:POKE 623,4
1 POKE 53248,100:POKE 53256,0:POKE 53257,1:POKE 704,55:POKE 53248,155:FOR I=0 TO 4*128:DPOKE PM+I*2,0:NEXT I:F$="{ATASCII stuff}":COLOR 3:FOR Y=10 TO 70 STEP 10:FOR X=110 TO 40 STEP -10:CIRCLE X,Y,5:NEXT X:NEXT Y
2 WHILE 1:T=NOT T:COLOR T+1:M=M+1:PRINT "Player ";T+1;"'s turn":IF M=57:PRINT "TIE GAME":SOUND 0,200,10,8:PAUSE 6:SOUND :WHILE STRIG(T):WEND :CLR :RUN :ENDIF :X=0:WHILE X=0:X=4:IF T:POKE 704,202:ELSE :POKE 704,40:ENDIF
3 MOVE F,PM+522,10:WHILE STRIG(T):POKE 53248,75+10*X:X=X+(STICK(T)=7)-(STICK(T)=11):IF X<1:X=8:ENDIF :IF X>8:X=1:ENDIF :PAUSE 4:WEND :IF P(X)=7:SOUND 0,99,6,8:PAUSE 5:SOUND :X=0:ENDIF :WEND
4 P(X)=P(X)+1:G(X,P(X))=T+1:FOR I=PM+512+10 TO PM+512+91-P(X)*10:MOVE F,I,10:POKE 53248,75+10*X:NEXT I:PAINT 30+(10*X),80-10*P(X):POKE 53248,0:MOVE FC,PM+512+92-P(X)*10,9
5 IF P(X)>3:IF G(X,P(X))&G(X,P(X)-1)&G(X,P(X)-2)&G(X,P(X)-3):GOTO 200:ENDIF :ENDIF :FOR X=1 TO 5:FOR Y=1 TO 7:IF G(X,Y):IF G(X,Y)&G(X+1,Y)&G(X+2,Y)&G(X+3,Y):GOTO 200:ENDIF
6 IF G(X,Y)&G(X+1,Y+1)&G(X+2,Y+2)&G(X+3,Y+3):GOTO 200:ENDIF :IF Y>3:IF G(X,Y)&G(X+1,Y-1)&G(X+2,Y-2)&G(X+3,Y-3):GOTO 200:ENDIF :ENDIF :ENDIF :NEXT Y:NEXT X:WEND
200 PRINT "PLAYER ";T+1;" WINS!":FOR X=1 TO 255:POKE 708+T,X:SOUND 0,RAND(255),10,10:NEXT X:SOUND :WHILE STRIG(T):WEND :CLR :RUN