Compucolor.org – Virtual Media

Listing of file='GOMOKO.BAS;01' on disk='vmedia/ncc_5-sector.ccvf'

10 PLOT 12:DIM A$(38,38)
20 PRINT "WELCOME TO THE ORIENTAL GAME OF GOMOKO."
30 PRINT :PRINT "THE GAME IS PLAYED ON AN N BY N GRID OF A SIZE"
40 PRINT "THAT YOU SPECIFY. DURING YOUR PLAY, YOU MAY COVER ONE GRID"
50 PRINT "INTERSECTION WITH A MARKER. THE OBJECT OF THE GAME IS TO GET"
60 PRINT "5 ADJACENT MARKERS IN A ROW -- HORIZONTALLY, VERTICALLY, OR"
70 PRINT "DIAGONALLY.  ON THE BOARD DIAGRAM, YOUR MOVES ARE MARKED"
80 PRINT "WITH A '`' AND THE COMPUTER MOVES WITH A '`'."
90 PRINT :PRINT "THE COMPUTER DOES N0T KEEP TRACK OF WHO HAS WON."
100 PRINT "TO END THE GAME, TYPE -1,-1 FOR YOUR MOVE.":PRINT
110 INPUT "WHAT IS YOUR BOARD SIZE (MIN 7/ MAX 19)";N
115 IF N> 6THEN 117
116 GOTO 120
117 IF N< 20THEN 210
120 PRINT "I SAID, THE MINIMUM IS 7, THE MAXIMUM IS 19.":GOTO 110
210 FOR I= 1TO N:FOR J= 1TO N
220 A$(I,J)= "{"
230 NEXT :NEXT
300 PRINT :PRINT "WE ALTERNATE MOVES. YOU GO FIRST...":PRINT
305 FOR S= 0TO 1000:NEXT :GOSUB 810
310 PLOT 3,40,1
318 INPUT "YOUR PLAY (I,J) ";I,J
320 IF I= - 1THEN 980
330 X= I:Y= J:GOSUB 910:IF L= 1THEN 409
340 PRINT "ILLEGAL MOVE.  TRY AGAIN...":GOTO 310
409 REM
410 IF A$(I,J)= "{"THEN 440
420 PRINT "SQUARE OCCUPIED.  TRY AGAIN...":GOTO 310
440 A$(I,J)= "`"
500 REM  *** COMPUTER TRIES AN INTELLIGENT MOVE ***
510 FOR E= - 1TO 1:FOR F= - 1TO 1:IF E+ F- E* F= 0THEN 590
540 X= I+ F:Y= J+ F:GOSUB 910
570 IF L= 0THEN 590
580 IF A$(X,Y)= "`"THEN 710
590 NEXT F:NEXT E
600 REM  *** COMPUTER TRIES A RANDOM MOVE ***
610 X= INT (N* RND (1)+ 1):Y= INT (N* RND (1)+ 1):GOSUB 910:IF L= 0THEN 610
650 IF A$(X,Y)< > "{"THEN 610
660 A$(X,Y)= "`":GOSUB 810:GOTO 310
710 X= I- E:Y= J- F:GOSUB 910
750 IF L= 0THEN 610
760 GOTO 650
800 REM  *** PRINT THE BOARD ***
810 PLOT 12
820 PLOT 3,N/ 2,0:PRINT "I"
825 PLOT 3,N+ 6,N/ 2+ 2:PRINT "J":PLOT 3,0,2
830 FOR I= 1TO N:FOR J= 1TO N:PRINT A$(I,J);
840 NEXT :PRINT "a";I:NEXT :RETURN
910 L= 1:IF X< 1THEN 970
920 IF X> NTHEN 970
930 IF Y< 1THEN 970
940 IF Y> NTHEN 970
950 RETURN
970 L= 0:RETURN
980 PRINT :PRINT "THANKS FOR THE GAME!!"
985 INPUT "PLAY AGAIN(1 FOR YES,0 FOR N)";Q
990 IF Q= 1THEN 110