Home of the original IBM PC emulator for browsers.
By Jeff Parsons
[Possibly adapted from a listing in one of those David Ahl books of “BASIC Games” – I don’t remember.]
10 REM - OTHELLO -
15 REM
20 A=53184:CO=79:CX=88
21 POKE11,0:POKE12,253
25 PL=1
30 GOSUB9000
40 DIMB(8,8)
50 B(4,5)=1:B(5,5)=2:B(4,4)=2:B(5,4)=1
60 GOSUB8000
70 GOSUB7000
80 GOSUB6000
90 GOSUB5000
100 GOSUB4000
110 GOTO60
999 END
4000 REM - MAKE MOVE IN TABLE -
4010 IFUP=0ANDDN=0ANDLF=0ANDRT=0ANDUL=0ANDUR=0ANDLL=0ANDLR=0THEN4990
4020 B(C,R)=PL
4030 IFUP=0THEN4100
4040 FORZ=1TOUP
4050 B(C,R+Z)=PL
4060 NEXT
4100 IFDN=0THEN4200
4110 FORZ=1TODN
4120 B(C,R-Z)=PL
4130 NEXT
4200 IFLF=0THEN4300
4210 FORZ=1TOLF
4220 B(C-Z,R)=PL
4230 NEXT
4300 IFRT=0THEN4400
4310 FORZ=1TORT
4320 B(C+Z,R)=PL
4330 NEXT
4400 IFUL=0THEN4500
4410 FORZ=1TOUL
4420 B(C-Z,R+Z)=PL
4430 NEXT
4500 IFUR=0THEN4600
4510 FORZ=1TOUR
4520 B(C+Z,R+Z)=PL
4530 NEXT
4600 IFLL=0THEN4700
4610 FORZ=1TOLL
4620 B(C-Z,R-Z)=PL
4630 NEXT
4700 IFLR=0THEN4900
4710 FORZ=1TOLR
4720 B(C+Z,R-Z)=PL
4730 NEXT
4900 PL=3-PL
4990 RETURN
5000 REM - LEGAL MOVE? -
5010 UP=0:DN=0:LF=0:RT=0:UL=0:UR=0:LL=0:LR=0
5020 IFB(C,R)<>0THENGOTO5990
5030 FORTR=R-1TO1STEP-1
5040 IFTR<1THENDN=0:GOTO5100
5045 IFB(C,TR)=0THENDN=0:GOTO5100
5050 IFB(C,TR)=3-PLANDTR>1THENDN=DN+1
5060 IFB(C,TR)=PLTHENGOTO5100
5070 NEXT
5080 DN=0
5100 FORTR=R+1TO8
5110 IFTR>8THENUP=0:GOTO5200
5115 IFB(C,TR)=0THENUP=0:GOTO5200
5120 IFB(C,TR)=(3-PL)ANDTR<8THENUP=UP+1
5130 IFB(C,TR)=PLTHENGOTO5200
5140 NEXT
5150 UP=0
5200 FORTC=C-1TO1STEP-1
5210 IFTC<1THENLF=0:GOTO5300
5215 IFB(TC,R)=0THENLF=0:GOTO5300
5220 IFB(TC,R)=(3-PL)ANDTC>1THENLF=LF+1
5230 IFB(TC,R)=PLTHENGOTO5300
5240 NEXT
5250 LF=0
5300 FORTC=C+1TO8
5310 IFTC>8THENRT=0:GOTO5400
5315 IFB(TC,R)=0THENRT=0:GOTO5400
5320 IFB(TC,R)=(3-PL)ANDTC<8THENRT=RT+1
5330 IFB(TC,R)=PLTHENGOTO5400
5340 NEXT
5350 RT=0
5400 TC=C-1
5410 FORTR=R+1TO8
5420 IFTR>8ORTC<1THENUL=0:GOTO5500
5425 IFB(TC,TR)=0THENUL=0:GOTO5500
5430 IFB(TC,TR)=(3-PL)ANDTR<8ANDTC>1THENUL=UL+1
5440 IFB(TC,TR)=PLTHENGOTO5500
5450 TC=TC-1
5460 NEXT
5470 UL=0
5500 TC=C+1
5510 FORTR=R+1TO8
5520 IFTR>8ORTC>8THENUR=0:GOTO5600
5525 IFB(TC,TR)=0THENUR=0:GOTO5600
5530 IFB(TC,TR)=(3-PL)ANDTR<8ANDTC<8THENUR=UR+1
5540 IFB(TC,TR)=PLTHENGOTO5600
5550 TC=TC+1
5560 NEXT
5570 UR=0
5600 TC=C-1
5610 FORTR=R-1TO1STEP-1
5620 IFTR<1ORTC<1THENLL=0:GOTO5700
5625 IFB(TC,TR)=0THENLL=0:GOTO5700
5630 IFB(TC,TR)=(3-PL)ANDTR>1ANDTC>1THENLL=LL+1
5640 IFB(TC,TR)=PLTHENGOTO5700
5650 TC=TC-1
5660 NEXT
5670 LL=0
5700 TC=C+1
5710 FORTR=R-1TO1STEP-1
5720 IFTR<1ORTC>8THENLR=0:GOTO5990
5725 IFB(TC,TR)=0THENLR=0:GOTO5990
5730 IFB(TC,TR)=(3-PL)ANDTR>1ANDTC<8THENLR=LR+1
5740 IFB(TC,TR)=PLTHENGOTO5990
5750 TC=TC+1
5760 NEXT
5770 LR=0
5990 RETURN
6000 REM - CHECK INPUT -
6010 REM - AND SET UP -
6020 REM - R (ROW) AND -
6030 REM - C (COLUMN) -
6040 IFLEN(I$)<>2THENGOSUB7000:GOTO6040
6050 C1=ASC(LEFT$(I$,1)):C2=ASC(RIGHT$(I$,1))
6060 IF(C1>=65)AND(C1<=72)THENR=C1:GOTO6080
6070 IF(C2>=65)AND(C2<=72)THENR=C2:GOTO6090
6075 GOSUB7000:GOTO6040
6080 IF(C2<49)OR(C2>56)THENGOSUB7000:GOTO6040
6085 C=C2:GOTO6100
6090 IF(C1<49)OR(C1>56)THENGOSUB7000:GOTO6040
6095 C=C1
6100 C=C-48:R=R-64
6990 RETURN
7000 REM - INPUT MOVE -
7001 POKE(A+256+20*32+18),(PL+48)
7005 I$="":T2=A+256+21*32+7
7006 FORX=1TO20:POKE(T2+X),32:NEXT
7009 POKET2,63:T2=T2+1:POKET2,161
7010 T1=USR(T1):T1=PEEK(531)
7011 IFT1=13THEN7030
7012 IFT1<>127THEN7019
7013 IFI$=""THEN7010
7015 POKET2,32:T2=T2-1:POKET2,161
7017 IFLEN(I$)=1THENI$="":GOTO7010
7018 I$=LEFT$(I$,LEN(I$)-1):GOTO7010
7019 I$=I$+CHR$(T1)
7020 POKET2,T1:T2=T2+1:POKET2,161
7023 IFLEN(I$)>10THENGOTO7000
7025 GOTO7010
7030 FORY=1TO8
7990 RETURN
8000 REM - MAKE MOVE -
8010 S=A+8*32+7
8020 FORX=1TO8
8030 FORY=1TO8
8040 P=S+2*X+2*32*(8-Y)
8050 IFB(X,Y)=1THENPOKEP,CX
8060 IFB(X,Y)=2THENPOKEP,CO
8080 NEXTY,X
8990 RETURN
9000 REM - FRAME -
9010 T1=A+256
9020 FORY=1TO24
9030 PRINT
9040 NEXT
9050 FORX=1TO16
9060 POKE(A+224+X+7),128
9070 NEXT
9080 FORY=1TO16STEP2
9090 FORX=1TO8
9100 T2=2*(X-1)
9110 POKE(T1+(Y-1)*32+8+T2),136
9120 POKE(T1+Y*32+8+T2),209
9130 POKE(T1+Y*32+9+T2),128
9140 NEXTX
9150 POKE(T1+(Y-1)*32+8+2*(X-1)),136
9160 POKE(T1+Y*32+8+2*(X-1)),136
9170 NEXTY
9180 T3=T1+6
9190 T4=T3+577
9200 FORZ=1TO8
9210 POKE(T3+2*(8-Z)*32),((Z-1)+65)
9220 POKE(T4+2*Z),((Z-1)+49)
9230 NEXT
9240 T2=A+903
9250 POKET2,ASC("P"):T2=T2+1
9260 POKET2,ASC("L"):T2=T2+1
9270 POKET2,ASC("A"):T2=T2+1
9280 POKET2,ASC("Y"):T2=T2+1
9290 POKET2,ASC("E"):T2=T2+1
9300 POKET2,ASC("R"):T2=T2+1
9310 T2=T2+1
9320 POKET2,ASC("N"):T2=T2+1
9330 POKET2,ASC("O"):T2=T2+1
9340 POKET2,ASC("."):T2=T2+3
9350 POKET2,ASC(":"):T2=T2+1
9990 RETURN
10000 REM - FUN -
10005 A=53248
10010 FORX=1TO24:PRINT:NEXT:T1=A+263
10020 FORX=1TO16
10025 FORY=1TO8
10026 POKET1+(X-2)*32,32
10035 NEXTY,X
10040 FORX=16TO1STEP-1
10045 FORY=8TO1STEP-1
10046 POKET1+X*32,32
10050 POKET1+(X-1)*32,(9-Y)+127
10055 NEXTY,X
10060 GOTO10020