10 REM *** CONVERTED TO RUN ON IBM-PC BY YUTAKA ARAI ***
20 CLS : PRINT TAB(20); "*** OTHELLO ***": PRINT : DIM A(9, 9), I4(8), J4(8), C$(8), D$(2): PRINT "SHOULD I PLAY MY BEST STRATEGY"; : S2 = 0
30 INPUT X$: IF LEFT$(X$, 1) = "N" THEN 60
40 IF LEFT$(X$, 1) <> "Y" THEN 30
50 S2 = 2
60 B = -1: W = 1: D$(B + 1) = "X": D$(O + 1) = ".": D$(W + 1) = "O": FOR K = 1 TO 8: READ I4(K): NEXT K: DATA 0,-1,-1,-1,0,1,1,1: FOR K = 1 TO 8: READ J4(K): NEXT K: DATA 1,1,0,-1,-1,-1,0,1: FOR K = 1 TO 8: READ C$(K): NEXT K: DATA A,B,C,D,E,F,G,H
70 FOR I = 0 TO 9: FOR J = 0 TO 9: A(I, J) = 0: NEXT J: NEXT I: A(4, 4) = W: A(5, 5) = W: A(4, 5) = B: A(5, 4) = B: C1 = 2: H1 = 2: N1 = 4: Z = 0: PRINT "DO YOU WANT TO HAVE X OR O "; : C = W: H = B
80 INPUT X$: IF LEFT$(X$, 1) = "X" THEN 110
90 IF LEFT$(X$, 1) <> "O" THEN 80
100 C = B: H = W
110 PRINT "DO YOU WANT TO GO FIRST";
120 INPUT X$: IF LEFT$(X$, 1) = "N" THEN 170
130 IF LEFT$(X$, 1) <> "Y" THEN 120
140 GOSUB 820: GOTO 330
150 IF F2 = 0 THEN 170
160 INPUT X$
170 B1 = -1: I3 = 0: J3 = 0: T1 = C: T2 = H: FOR J = 1 TO 2: NEXT J: FOR I = 1 TO 8: FOR J = 1 TO 8: IF A(I, J) <> 0 THEN 280
180 GOSUB 720: IF F1 = 0 THEN 280
190 U = -1: GOSUB 750: IF S1 = 0 THEN 280
200 IF (I - 1) * (I - 8) <> 0 THEN 220
210 S1 = S1 + S2
220 IF (J - 1) * (J - 8) <> 0 THEN 240
230 S1 = S1 + S2
240 IF S1 < B1 THEN 280
250 IF S1 > B1 THEN 270
260 R = RND(1): IF R > .5 THEN 280
270 B1 = S1: I3 = I: J3 = J
280 NEXT J: NEXT I: IF B1 > 0 THEN 310
290 PRINT "I HAVE TO FORFEIT MY MOVE": IF Z = 1 THEN 520
300 Z = 1: GOTO 330
310 Z = 0: CLS : PRINT "I WILL MOVE TO "; : PRINT I3; : PRINT ", "; : PRINT C$(J3): I = I3: J = J3: U = 1: GOSUB 750: C1 = C1 + S1 + 1: H1 = H1 - S1: N1 = N1 + 1: PRINT "THAT GIVES ME "; : PRINT S1; : PRINT " OF YOUR PIECES": GOSUB 820: IF H1 = 0  _
THEN 520
320 IF N1 = 64 THEN 520
330 T1 = H: T2 = C
340 PRINT "YOUR MOVE -- (ROW COL) ";
350 INPUT X$: I = VAL(X$): X$ = RIGHT$(X$, 1): IF I < 0 THEN 350
360 IF I > 8 THEN 350
370 IF I <> 0 THEN 410
380 PRINT "ARE YOU FORFEITING YOUR TURN"; : INPUT X$: IF LEFT$(X$, 1) <> "Y" THEN 340
390 IF Z = 1 THEN 520
400 Z = 1: GOTO 150
410 FOR J = 1 TO 8: IF C$(J) = X$ THEN 430
420 NEXT J: GOTO 350
430 IF A(I, J) = 0 THEN 450
440 PRINT "SORRY, THAT SQUARE IS OCCUPIED; TRY AGAIN": GOTO 350
450 GOSUB 720: IF F1 = 1 THEN 470
460 PRINT "SORRY, YOU ARE NOT NEXT TO ONE OF MY PIECES;": PRINT "TRY AGAIN": GOTO 350
470 U = -1: GOSUB 750: IF S1 > 0 THEN 490
480 PRINT "SORRY, THAT DOESN'T FLANK A ROW; TRY AGAIN": GOTO 350
490 Z = 0: CLS : PRINT "THAT GIVES YOU "; : PRINT S1; : PRINT " OF MY PIECES": U = 1: GOSUB 750: H1 = H1 + S1 + 1: C1 = C1 - S1: N1 = N1 + 1: GOSUB 820: IF C1 = 0 THEN 520
500 IF N1 = 64 THEN 520
510 GOTO 150
520 PRINT : PRINT "YOU HAVE "; : PRINT H1; : PRINT "PIECES AND I HAVE "; : PRINT C1; : PRINT "PIECES--"; : IF H1 = C1 THEN 550
530 IF H1 > C1 THEN 560
540 PRINT "SORRY, I WON THAT ONE.": GOTO 570
550 PRINT " A TIE !!": GOTO 680
560 PRINT "YOU WON !"
570 C1 = C1 - H1: IF C1 > 0 THEN 590
580 C1 = -C1
590 C1 = (64 * C1) / N1: PRINT "THAT WAS A "; : IF C1 < 11 THEN 670
600 IF C1 < 25 THEN 660
610 IF C1 < 39 THEN 650
620 IF C1 < 53 THEN 640
630 PRINT "PERFECT GAME!!!": GOTO 680
640 PRINT "WALKAWAY": GOTO 680
650 PRINT "FIGHT.": GOTO 680
660 PRINT "HOT GAME !": GOTO 680
670 PRINT "SQUEAKER ! !"
680 PRINT : PRINT "DO YOU WANT TO PLAY ANOTHER GAME";
690 INPUT X$: IF LEFT$(X$, 1) = "Y" THEN 70
700 IF LEFT$(X$, 1) <> "N" THEN 690
710 PRINT "THANKS FOR PLAYING": GOTO 850
720 FOR I1 = -1 TO 1: FOR J1 = -1 TO 1: IF A(I + I1, J + J1) = T2 THEN 740
730 NEXT J1: NEXT I1: F1 = 0: RETURN
740 F1 = 1: RETURN
750 S1 = 0: FOR K = 1 TO 8: I5 = I4(K): J5 = J4(K): I6 = I + I5: J6 = J + J5: S3 = 0: IF A(I6, J6) <> T2 THEN 810
760 S3 = S3 + 1: I6 = I6 + I5: J6 = J6 + J5: IF A(I6, J6) = T1 THEN 790
770 IF A(I6, J6) = 0 THEN 810
780 GOTO 760
790 S1 = S1 + S3: IF U <> 1 THEN 810
800 I6 = I: J6 = J: FOR K1 = 0 TO S3: A(I6, J6) = T1: I6 = I6 + I5: J6 = J6 + J5: NEXT K1
810 NEXT K: RETURN
820 PRINT : PRINT "    A B C D E F G H       COMPUTER           HUMAN": FOR I = 1 TO 8: PRINT I; : FOR J = 1 TO 8: PRINT " "; : PRINT D$(A(I, J) + 1); : NEXT J: IF I = 1 THEN PRINT TAB(28); C1; TAB(46); H1;
830 PRINT : NEXT I: PRINT : RETURN
840 GOTO 850
850 '

