-
Notifications
You must be signed in to change notification settings - Fork 1
/
connect4-fujinet.txt
14 lines (14 loc) · 2.5 KB
/
connect4-fujinet.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0 DIM A$(10),B$(9),A(8),B(8,10):DIM C$(128):DIM D$(128):DIM E$(128):DIM F$(32):DIM G$(32):DIM H$(128):POKE 65,0:A=1:GRAPHICS 7:B=ADR(A$):C=ADR(B$):B$="{9 ATASCII heart characters}":PRINT "Welcome to Connect 4"
1 D=PEEK(106)-32:POKE 54279,D:E=256*D:POKE 559,46:POKE 53277,3:POKE 623,4:POKE 53248,100:POKE 53256,0:POKE 53257,1:POKE 704,55:POKE 53248,155:FOR F=0 TO 4*128:DPOKE E+F*2,0:NEXT F
2 A$="{10 ATASCII characters}":PRINT "ENTER PLAYER NAME":INPUT #16,F$:PRINT "ENTER HOSTNAME OR RETURN TO LISTEN ":INPUT #16,C$:IF (C$=""):POKE 752,0:PRINT "LISTENING FOR CONNECTION...":D$="N:TCP://:6502/":OPEN #1,12,2,D$:G=0:WHILE (G=0)
3 STATUS #1,H:G=PEEK(748):WEND :XIO 65,#1,12,2,"N:":INPUT #1,G$:PRINT #1;F$:I=0:ELSE :D$="N:TCP://":D$(LEN(D$)+1)=C$:D$(LEN(D$)+1)=":6502/":PRINT "CONNECTING TO ";D$:OPEN #1,12,2,D$:PRINT #1;F$:INPUT #1,G$
4 I=1:ENDIF :PRINT "CONNECTED!":FOR G=255 TO 0 STEP -45:SOUND 0,G,10,15:FOR J=0 TO 10:NEXT J:NEXT G:SOUND 0,0,0,0
50 IF (K):COLOR 0:FOR G=1 TO 75:PLOT 35,G:DRAWTO 115,G:NEXT G:K=0:FOR G=0 TO 8:A(G)=0:NEXT G:FOR G=0 TO 8:FOR L=0 TO 10:B(G,L)=0:NEXT L:NEXT G:ENDIF :COLOR 3:FOR L=10 TO 70 STEP 10:FOR G=110 TO 40 STEP -10
51 CIRCLE G,L,5:NEXT G:NEXT L:WHILE 1:A=NOT A:COLOR A+1:K=K+1:IF (K=57):PRINT "TIE GAME":SOUND 0,200,10,8:PAUSE 6:SOUND :GOTO 50:ENDIF :IF (A=I):PRINT F$;"'s turn.":ELSE :PRINT G$;"'s turn.":ENDIF :G=0:WHILE G=0:G=4:IF A
52 POKE 704,202:ELSE :POKE 704,40:ENDIF :MOVE B,E+522,10:IF (A=I):PRINT #1;G:WHILE STRIG(0):POKE 53248,75+10*G:M=(STICK(0)=7)-(STICK(0)=11):IF (M):G=G+M:IF G<1:G=8:ENDIF :IF G>8:G=1:ENDIF
53 PRINT #1;G:PAUSE 4:ENDIF :WEND :PRINT #1;"10":IF (A(G)=7):SOUND 0,99,6,8:PAUSE 5:SOUND :G=0:ENDIF :ELSE :N=G:WHILE (N<10):O=0:WHILE (O=0):STATUS #1,H:O=PEEK(746):WEND :INPUT #1,N:IF (N<10):G=N
54 POKE 53248,75+10*G:ENDIF :WEND :IF (A(G)=7):SOUND 0,99,6,8:PAUSE 5:SOUND :G=0:ENDIF :ENDIF :WEND :A(G)=A(G)+1:B(G,A(G))=A+1:FOR F=E+512+10 TO E+512+91-A(G)*10:MOVE B,F,10
55 POKE 53248,75+10*G:NEXT F:PAINT 30+(10*G),80-10*A(G):POKE 53248,0:MOVE C,E+512+92-A(G)*10,9:IF A(G)>3:IF B(G,A(G))&B(G,A(G)-1)&B(G,A(G)-2)&B(G,A(G)-3):GOTO 200:ENDIF :ENDIF
56 FOR G=1 TO 5:FOR L=1 TO 7:IF B(G,L):IF B(G,L)&B(G+1,L)&B(G+2,L)&B(G+3,L):GOTO 200:ENDIF :IF B(G,L)&B(G+1,L+1)&B(G+2,L+2)&B(G+3,L+3):GOTO 200:ENDIF :IF L>3
57 IF B(G,L)&B(G+1,L-1)&B(G+2,L-2)&B(G+3,L-3):GOTO 200:ENDIF :ENDIF :ENDIF :NEXT L:NEXT G:WEND
200 IF (A=I):PRINT F$;" WINS!!";:ELSE :PRINT G$;" WINS!!";:ENDIF :FOR G=1 TO 255:POKE 708+A,G:SOUND 0,RAND(255),10,10:NEXT G:SOUND :GOTO 50