OXAUTOLN2 Tic-Tac-Toe Learning Program.
#1
Below & Attached is My first (2nd Version) attempt at making a Learning A.I Program!
It will Learn & get Stronger at playing Tic-Tac-Toe / Noughts & Crosses


Anthony.


Code:
DECLARE SUB LEARNDATA1 ()
DIM SHARED LASTDRAWN AS STRING
DIM SHARED COMP01RVAL AS INTEGER
DIM SHARED COMP02RVAL AS INTEGER
DIM SHARED GAMETYP AS INTEGER
DIM SHARED WHOMFST AS STRING
DIM SHARED MOVTYPN AS STRING
DIM SHARED MOVTYPR AS STRING
DIM SHARED MOVMADE AS STRING
DIM SHARED HUMANMOVED AS INTEGER
DIM SHARED COMP01MOVED AS INTEGER
DIM SHARED COMP02MOVED AS INTEGER
DIM SHARED COMPMAXVAL AS LONG
DIM SHARED AVV AS INTEGER
DIM SHARED BVV AS INTEGER
DIM SHARED CVV AS INTEGER
DIM SHARED DVV AS INTEGER
DIM SHARED EVV AS INTEGER
DIM SHARED FVV AS INTEGER
DIM SHARED GVV AS INTEGER
DIM SHARED HVV AS INTEGER
DIM SHARED IVV AS INTEGER
DIM SHARED P001 AS STRING
DIM SHARED P002 AS STRING
DIM SHARED P003 AS STRING
DIM SHARED P004 AS STRING
DIM SHARED P005 AS STRING
DIM SHARED P006 AS STRING
DIM SHARED P007 AS STRING
DIM SHARED P008 AS STRING
DIM SHARED P009 AS STRING
DIM SHARED P001VN AS STRING
DIM SHARED P002VN AS STRING
DIM SHARED P003VN AS STRING
DIM SHARED P004VN AS STRING
DIM SHARED P005VN AS STRING
DIM SHARED P006VN AS STRING
DIM SHARED P007VN AS STRING
DIM SHARED P008VN AS STRING
DIM SHARED P009VN AS STRING
DIM SHARED P001VR AS STRING
DIM SHARED P002VR AS STRING
DIM SHARED P003VR AS STRING
DIM SHARED P004VR AS STRING
DIM SHARED P005VR AS STRING
DIM SHARED P006VR AS STRING
DIM SHARED P007VR AS STRING
DIM SHARED P008VR AS STRING
DIM SHARED P009VR AS STRING
DIM SHARED PTEMPVALN AS STRING
DIM SHARED PTEMPVALR AS STRING
DIM SHARED MOVTYP000N AS STRING
DIM SHARED MOVTYP001N AS STRING
DIM SHARED MOVTYP002N AS STRING
DIM SHARED MOVTYP003N AS STRING
DIM SHARED MOVTYP004N AS STRING
DIM SHARED MOVTYP005N AS STRING
DIM SHARED MOVTYP006N AS STRING
DIM SHARED MOVTYP007N AS STRING
DIM SHARED MOVTYP008N AS STRING
DIM SHARED MOVTYP009N AS STRING
DIM SHARED MOVTYP000R AS STRING
DIM SHARED MOVTYP001R AS STRING
DIM SHARED MOVTYP002R AS STRING
DIM SHARED MOVTYP003R AS STRING
DIM SHARED MOVTYP004R AS STRING
DIM SHARED MOVTYP005R AS STRING
DIM SHARED MOVTYP006R AS STRING
DIM SHARED MOVTYP007R AS STRING
DIM SHARED MOVTYP008R AS STRING
DIM SHARED MOVTYP009R AS STRING
DIM SHARED MOVREG000N AS STRING
DIM SHARED MOVREG001N AS STRING
DIM SHARED MOVREG002N AS STRING
DIM SHARED MOVREG003N AS STRING
DIM SHARED MOVREG004N AS STRING
DIM SHARED MOVREG005N AS STRING
DIM SHARED MOVREG006N AS STRING
DIM SHARED MOVREG007N AS STRING
DIM SHARED MOVREG008N AS STRING
DIM SHARED MOVREG009N AS STRING
DIM SHARED MOVREG000R AS STRING
DIM SHARED MOVREG001R AS STRING
DIM SHARED MOVREG002R AS STRING
DIM SHARED MOVREG003R AS STRING
DIM SHARED MOVREG004R AS STRING
DIM SHARED MOVREG005R AS STRING
DIM SHARED MOVREG006R AS STRING
DIM SHARED MOVREG007R AS STRING
DIM SHARED MOVREG008R AS STRING
DIM SHARED MOVREG009R AS STRING
DIM SHARED MOVSCOUNT AS INTEGER
DIM SHARED MOVSCTDWN AS INTEGER
DIM SHARED WLINE001 AS STRING
DIM SHARED WLINE002 AS STRING
DIM SHARED WLINE003 AS STRING
DIM SHARED WLINE004 AS STRING
DIM SHARED WLINE005 AS STRING
DIM SHARED WLINE006 AS STRING
DIM SHARED WLINE007 AS STRING
DIM SHARED WLINE008 AS STRING
DIM SHARED GMOVERO AS INTEGER
DIM SHARED GMOVERX AS INTEGER
DIM SHARED GMOVERD AS INTEGER
DIM SHARED DRAWNSAVEDONE AS INTEGER
SCREEN 11
REM-----------------------------------------------------------------------------------------------------------
CLS
PRINT : PRINT
PRINT TAB(11); "OXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXO"
PRINT : PRINT
PRINT TAB(90); "         { OXAUTOLN2 } O&X AUTO SELF LEARNING PROGRAM!  "
PRINT : PRINT
PRINT TAB(90); "       ORIGINAL-V1.23/02/2002 THIS VERSION-V2.06/12/2012 "
PRINT : PRINT
PRINT TAB(90); "          LEARNING NOW APPEND SAVED! INTO O&XDATA.TXT "
PRINT : PRINT
PRINT TAB(90); "     COPY & PASTE INTO SUB LEARNDATA1 AT PROGRAM END & SAVE! "
PRINT : PRINT
PRINT TAB(90); "           THEN DELETE O&XDATA.TXT FOR NEW LEARNING!  "
PRINT : PRINT
PRINT TAB(90); "                 BY, [A][R][B] COMPUTER SOFTWARE. "
PRINT : PRINT
PRINT TAB(11); "OXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXO"
PRINT : PRINT
INPUT " PRESS (ENTER) TO START PROGRAM! "; XYZ$
LASTDRAWNINPUT:
CLS
PRINT : PRINT
INPUT " WAS THE LAST GAME A DRAWN GAME! ENTER (Y) OR (N) "; LASTDRAWN
IF LASTDRAWN = "y" THEN LASTDRAWN = "Y"
IF LASTDRAWN = "n" THEN LASTDRAWN = "N"
IF LASTDRAWN = "Y" THEN GOTO START
IF LASTDRAWN = "N" THEN GOTO START
GOTO LASTDRAWNINPUT
REM-----------------------------------------------------------------------------------------------------------
START:
CLS
REM BELOW GIVE MAIN BOARD REGISTER START VARIABLES! A STRING EMPTY SQUARE VALUE!
P001VN = "E": P002VN = "E": P003VN = "E"
P004VN = "E": P005VN = "E": P006VN = "E"
P007VN = "E": P008VN = "E": P009VN = "E"
PTEMPVALN = P001VN + P002VN + P003VN + P004VN + P005VN + P006VN + P007VN + P008VN + P009VN
REM BELOW REVERSE LEARNING BOARD REGISTER START VARIABLES!
P001VR = "E": P002VR = "E": P003VR = "E"
P004VR = "E": P005VR = "E": P006VR = "E"
P007VR = "E": P008VR = "E": P009VR = "E"
PTEMPVALR = P001VR + P002VR + P003VR + P004VR + P005VR + P006VR + P007VR + P008VR + P009VR
PRINT : PRINT
INPUT " ENTER GAME TYPE!  HUMAN V COMPUTER = 1  COMPUTER V COMPUTER = 2  "; GAMETYP
IF GAMETYP = 1 THEN GOTO WHOMOVESFIRST
IF GAMETYP = 2 THEN GOTO COMPRANDOMSTART
GOTO START
REM-----------------------------------------------------------------------------------------------------------
WHOMOVESFIRST:
CLS
PRINT : PRINT
INPUT " ENTER WHO MOVES FIRST!  HUMAN = (O)  COMPUTER = (X)  "; WHOMFST
IF WHOMFST = "o" THEN WHOMFST = "O"
IF WHOMFST = "x" THEN WHOMFST = "X"
IF WHOMFST = "O" THEN MOVTYPN = ""
IF WHOMFST = "O" THEN GOSUB BOARD
IF WHOMFST = "O" THEN GOTO HUMAN
IF WHOMFST = "X" THEN MOVTYPN = ""
IF WHOMFST = "X" THEN GOSUB BOARD
IF WHOMFST = "X" THEN GOTO COMPUTER01
GOTO WHOMOVESFIRST
REM-----------------------------------------------------------------------------------------------------------
COMPRANDOMSTART:
RANDOMIZE TIMER
COMPRAND12 = INT(RND * 100) + 1
IF COMPRAND12 < 50 THEN MOVTYPN = ""
IF COMPRAND12 < 50 THEN GOSUB BOARD
IF COMPRAND12 < 50 THEN GOTO COMPUTER01
IF COMPRAND12 > 50 THEN MOVTYPN = ""
IF COMPRAND12 > 50 THEN GOSUB BOARD
IF COMPRAND12 > 50 THEN GOTO COMPUTER02
GOTO COMPRANDOMSTART
REM-----------------------------------------------------------------------------------------------------------
BOARD:
CLS
REM BELOW PRINT ALL MOVES MADE ONTO THE BOARD!
IF MOVMADE = "A" AND P001 = "" THEN P001 = MOVTYPN
IF MOVMADE = "B" AND P002 = "" THEN P002 = MOVTYPN
IF MOVMADE = "C" AND P003 = "" THEN P003 = MOVTYPN
IF MOVMADE = "D" AND P004 = "" THEN P004 = MOVTYPN
IF MOVMADE = "E" AND P005 = "" THEN P005 = MOVTYPN
IF MOVMADE = "F" AND P006 = "" THEN P006 = MOVTYPN
IF MOVMADE = "G" AND P007 = "" THEN P007 = MOVTYPN
IF MOVMADE = "H" AND P008 = "" THEN P008 = MOVTYPN
IF MOVMADE = "I" AND P009 = "" THEN P009 = MOVTYPN
PRINT : PRINT : PRINT : PRINT
PRINT TAB(20); "(A)= "; P001; TAB(40); "(B)= "; P002; TAB(60); "(C)= "; P003
PRINT : PRINT : PRINT : PRINT : PRINT
PRINT TAB(20); "(D)= "; P004; TAB(40); "(E)= "; P005; TAB(60); "(F)= "; P006
PRINT : PRINT : PRINT : PRINT : PRINT
PRINT TAB(20); "(G)= "; P007; TAB(40); "(H)= "; P008; TAB(60); "(I)= "; P009
PRINT : PRINT : PRINT : PRINT
IF MOVTYPN = "" THEN RETURN: REM BACK TO HUMAN (NO INPUT) OR COMPUTERS AT RANDOM START!
REM BELOW MAIN BOARD POSITION! MOVE REGISTER VARIABLES!
IF P001 <> "" AND P001VN = "E" THEN P001VN = MOVTYPN
IF P002 <> "" AND P002VN = "E" THEN P002VN = MOVTYPN
IF P003 <> "" AND P003VN = "E" THEN P003VN = MOVTYPN
IF P004 <> "" AND P004VN = "E" THEN P004VN = MOVTYPN
IF P005 <> "" AND P005VN = "E" THEN P005VN = MOVTYPN
IF P006 <> "" AND P006VN = "E" THEN P006VN = MOVTYPN
IF P007 <> "" AND P007VN = "E" THEN P007VN = MOVTYPN
IF P008 <> "" AND P008VN = "E" THEN P008VN = MOVTYPN
IF P009 <> "" AND P009VN = "E" THEN P009VN = MOVTYPN
REM BELOW MAIN BOARD POSITION! MOVE REGISTER REVERSE VARIABLES!
REM BELOW SET TYPE(R) VARIABLES FOR REVERSE MOVES LEARNING!
IF MOVTYPN = "O" THEN MOVTYPR = "X"
IF MOVTYPN = "X" THEN MOVTYPR = "O"
IF P001 <> "" AND P001VR = "E" THEN P001VR = MOVTYPR
IF P002 <> "" AND P002VR = "E" THEN P002VR = MOVTYPR
IF P003 <> "" AND P003VR = "E" THEN P003VR = MOVTYPR
IF P004 <> "" AND P004VR = "E" THEN P004VR = MOVTYPR
IF P005 <> "" AND P005VR = "E" THEN P005VR = MOVTYPR
IF P006 <> "" AND P006VR = "E" THEN P006VR = MOVTYPR
IF P007 <> "" AND P007VR = "E" THEN P007VR = MOVTYPR
IF P008 <> "" AND P008VR = "E" THEN P008VR = MOVTYPR
IF P009 <> "" AND P009VR = "E" THEN P009VR = MOVTYPR
REM-----------------------------------------------------------------------------------------------------------
REM BELOW MAIN BOARD POSITIONS! NORMAL AND REVERSE LEARNING REGISTER VARIABLES!
PTEMPVALN = P001VN + P002VN + P003VN + P004VN + P005VN + P006VN + P007VN + P008VN + P009VN
PTEMPVALR = P001VR + P002VR + P003VR + P004VR + P005VR + P006VR + P007VR + P008VR + P009VR
MOVREGISTER000: REM BELOW MOVE (0) NORMAL AND REVERSE MOVE REGISTERS!
REM NOTICE!! THIS IS THE FIRST BEST MOVE EMPTY BOARD REGISTER! SO DIFFERENT!
IF MOVREG000N <> "" THEN GOTO MOVREGISTER001
MOVREG000N = "EEEEEEEEE": MOVTYP000N = MOVMADE
MOVREG000R = "EEEEEEEEE": MOVTYP000R = MOVMADE
REM NOTICE!! NO IMMEDIATE BRANCH TO (WINCHECKS) AS BOTH FIRST (2) REGISTERS DONE AT SAME TIME!
MOVREGISTER001: REM BELOW MOVE (1) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG001N <> "" THEN GOTO MOVREGISTER002
MOVSCOUNT = MOVSCOUNT + 1
MOVREG001N = PTEMPVALN: MOVTYP001N = MOVMADE
MOVREG001R = PTEMPVALR: MOVTYP001R = MOVMADE
GOTO WINCHECKS
MOVREGISTER002: REM BELOW MOVE (2) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG002N <> "" THEN GOTO MOVREGISTER003
MOVSCOUNT = MOVSCOUNT + 1
MOVREG002N = PTEMPVALN: MOVTYP002N = MOVMADE
MOVREG002R = PTEMPVALR: MOVTYP002R = MOVMADE
GOTO WINCHECKS
MOVREGISTER003: REM BELOW MOVE (3) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG003N <> "" THEN GOTO MOVREGISTER004
MOVSCOUNT = MOVSCOUNT + 1
MOVREG003N = PTEMPVALN: MOVTYP003N = MOVMADE
MOVREG003R = PTEMPVALR: MOVTYP003R = MOVMADE
GOTO WINCHECKS
MOVREGISTER004: REM BELOW MOVE (4) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG004N <> "" THEN GOTO MOVREGISTER005
MOVSCOUNT = MOVSCOUNT + 1
MOVREG004N = PTEMPVALN: MOVTYP004N = MOVMADE
MOVREG004R = PTEMPVALR: MOVTYP004R = MOVMADE
GOTO WINCHECKS
MOVREGISTER005: REM BELOW MOVE (5) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG005N <> "" THEN GOTO MOVREGISTER006
MOVSCOUNT = MOVSCOUNT + 1
MOVREG005N = PTEMPVALN: MOVTYP005N = MOVMADE
MOVREG005R = PTEMPVALR: MOVTYP005R = MOVMADE
GOTO WINCHECKS
MOVREGISTER006: REM BELOW MOVE (6) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG006N <> "" THEN GOTO MOVREGISTER007
MOVSCOUNT = MOVSCOUNT + 1
MOVREG006N = PTEMPVALN: MOVTYP006N = MOVMADE
MOVREG006R = PTEMPVALR: MOVTYP006R = MOVMADE
GOTO WINCHECKS
MOVREGISTER007: REM BELOW MOVE (7) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG007N <> "" THEN GOTO MOVREGISTER008
MOVSCOUNT = MOVSCOUNT + 1
MOVREG007N = PTEMPVALN: MOVTYP007N = MOVMADE
MOVREG007R = PTEMPVALR: MOVTYP007R = MOVMADE
GOTO WINCHECKS
MOVREGISTER008: REM BELOW MOVE (8) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG008N <> "" THEN GOTO MOVREGISTER009
MOVSCOUNT = MOVSCOUNT + 1
MOVREG008N = PTEMPVALN: MOVTYP008N = MOVMADE
MOVREG008R = PTEMPVALR: MOVTYP008R = MOVMADE
GOTO WINCHECKS
MOVREGISTER009: REM BELOW MOVE (9) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG009N <> "" THEN GOTO WINCHECKS
MOVSCOUNT = MOVSCOUNT + 1
MOVREG009N = PTEMPVALN: MOVTYP009N = MOVMADE
MOVREG009R = PTEMPVALR: MOVTYP009R = MOVMADE
REM-----------------------------------------------------------------------------------------------------------
WINCHECKS: REM BELOW CHECK IF ANY OF THE (8) WINNING LINES HAVE BEEN MADE!
WLINE001 = P001 + P002 + P003
WLINE002 = P004 + P005 + P006
WLINE003 = P007 + P008 + P009
WLINE004 = P001 + P004 + P007
WLINE005 = P002 + P005 + P008
WLINE006 = P003 + P006 + P009
WLINE007 = P001 + P005 + P009
WLINE008 = P003 + P005 + P007
IF WLINE001 = "OOO" THEN GMOVERO = 1
IF WLINE002 = "OOO" THEN GMOVERO = 1
IF WLINE003 = "OOO" THEN GMOVERO = 1
IF WLINE004 = "OOO" THEN GMOVERO = 1
IF WLINE005 = "OOO" THEN GMOVERO = 1
IF WLINE006 = "OOO" THEN GMOVERO = 1
IF WLINE007 = "OOO" THEN GMOVERO = 1
IF WLINE008 = "OOO" THEN GMOVERO = 1
IF WLINE001 = "XXX" THEN GMOVERX = 1
IF WLINE002 = "XXX" THEN GMOVERX = 1
IF WLINE003 = "XXX" THEN GMOVERX = 1
IF WLINE004 = "XXX" THEN GMOVERX = 1
IF WLINE005 = "XXX" THEN GMOVERX = 1
IF WLINE006 = "XXX" THEN GMOVERX = 1
IF WLINE007 = "XXX" THEN GMOVERX = 1
IF WLINE008 = "XXX" THEN GMOVERX = 1
REM BELOW CHECK IF ALL MOVES HAVE BEEN MADE!
IF MOVSCOUNT >= 9 THEN GMOVERD = 1
REM BELOW REGISTER WHO HAS JUST MADE A MOVE!
IF GAMETYP = 1 AND MOVTYPN = "O" THEN HUMANMOVED = 1
IF GAMETYP = 1 AND MOVTYPN = "X" THEN COMP01MOVED = 1
IF GAMETYP = 2 AND MOVTYPN = "X" THEN COMP01MOVED = 1
IF GAMETYP = 2 AND MOVTYPN = "O" THEN COMP02MOVED = 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
HUMAN:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
HUMANMOVED = 0
HUMANINPUT:
MOVMADE = ""
MOVTYPN = "O"
INPUT " HUMANS MOVE! ENTER THE LETTER (A - I) FOR YOUR MOVE!  "; MOVMADE
IF MOVMADE = "a" THEN MOVMADE = "A"
IF MOVMADE = "b" THEN MOVMADE = "B"
IF MOVMADE = "c" THEN MOVMADE = "C"
IF MOVMADE = "d" THEN MOVMADE = "D"
IF MOVMADE = "e" THEN MOVMADE = "E"
IF MOVMADE = "f" THEN MOVMADE = "F"
IF MOVMADE = "g" THEN MOVMADE = "G"
IF MOVMADE = "h" THEN MOVMADE = "H"
IF MOVMADE = "i" THEN MOVMADE = "I"
IF MOVMADE = "A" AND P001 = "" THEN GOSUB BOARD
IF MOVMADE = "B" AND P002 = "" THEN GOSUB BOARD
IF MOVMADE = "C" AND P003 = "" THEN GOSUB BOARD
IF MOVMADE = "D" AND P004 = "" THEN GOSUB BOARD
IF MOVMADE = "E" AND P005 = "" THEN GOSUB BOARD
IF MOVMADE = "F" AND P006 = "" THEN GOSUB BOARD
IF MOVMADE = "G" AND P007 = "" THEN GOSUB BOARD
IF MOVMADE = "H" AND P008 = "" THEN GOSUB BOARD
IF MOVMADE = "I" AND P009 = "" THEN GOSUB BOARD
IF GAMETYP = 1 AND HUMANMOVED = 1 THEN GOTO COMPUTER01
MOVTYPN = "": REM MAKES RETURN FROM BOARD WORK! AS NO MOVE INPUT MADE!
GOSUB BOARD
GOTO HUMANINPUT
REM-----------------------------------------------------------------------------------------------------------
COMPUTER01:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
COMP01MOVED = 0
MOVMADE = ""
MOVTYPN = "X"
PRINT " COMPUTER01 THINKING!........................................................."
CALL LEARNDATA1: REM CALL MAIN LEARNING DATA SUBS FOR BEST MOVE VALUES!
COMPMAXVAL = 1000000
IF LASTDRAWN = "Y" THEN GOTO COMP01RNDSTART
COMPUTER01INPUT:
IF AVV >= COMPMAXVAL AND P001 = "" THEN MOVMADE = "A"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF BVV >= COMPMAXVAL AND P002 = "" THEN MOVMADE = "B"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF CVV >= COMPMAXVAL AND P003 = "" THEN MOVMADE = "C"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF DVV >= COMPMAXVAL AND P004 = "" THEN MOVMADE = "D"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF EVV >= COMPMAXVAL AND P005 = "" THEN MOVMADE = "E"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF FVV >= COMPMAXVAL AND P006 = "" THEN MOVMADE = "F"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF GVV >= COMPMAXVAL AND P007 = "" THEN MOVMADE = "G"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF HVV >= COMPMAXVAL AND P008 = "" THEN MOVMADE = "H"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF IVV >= COMPMAXVAL AND P009 = "" THEN MOVMADE = "I"
COMPMAKEMOVE01:
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 1 AND COMP01MOVED = 1 THEN GOTO HUMAN
IF GAMETYP = 2 AND COMP01MOVED = 1 THEN GOTO COMPUTER02
COMPMAXVAL = COMPMAXVAL - 1
GOTO COMPUTER01INPUT
COMP01RNDSTART:
LASTDRAWN = "": REM LAST DRAWN GAME FIRST MOVE! NOW MADE!
RANDOMIZE TIMER
COMP01RVAL = INT(RND * 10) + 1
IF COMP01RVAL = 1 AND P001 = "" THEN MOVMADE = "A"
IF COMP01RVAL = 2 AND P002 = "" THEN MOVMADE = "B"
IF COMP01RVAL = 3 AND P003 = "" THEN MOVMADE = "C"
IF COMP01RVAL = 4 AND P004 = "" THEN MOVMADE = "D"
IF COMP01RVAL = 5 AND P005 = "" THEN MOVMADE = "E"
IF COMP01RVAL = 6 AND P006 = "" THEN MOVMADE = "F"
IF COMP01RVAL = 7 AND P007 = "" THEN MOVMADE = "G"
IF COMP01RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP01RVAL = 9 AND P009 = "" THEN MOVMADE = "I"
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 1 AND COMP01MOVED = 1 THEN GOTO HUMAN
IF GAMETYP = 2 AND COMP01MOVED = 1 THEN GOTO COMPUTER02
GOTO COMP01RNDSTART
REM-----------------------------------------------------------------------------------------------------------
COMPUTER02:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
COMP02MOVED = 0
MOVMADE = ""
MOVTYPN = "O"
PRINT " COMPUTER02 THINKING!........................................................."
CALL LEARNDATA1: REM CALL MAIN LEARNING DATA SUBS FOR BEST MOVE VALUES!
COMPMAXVAL = 1000000
IF LASTDRAWN = "Y" THEN GOTO COMP02RNDSTART
COMPUTER02INPUT:
IF AVV >= COMPMAXVAL AND P001 = "" THEN MOVMADE = "A"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF BVV >= COMPMAXVAL AND P002 = "" THEN MOVMADE = "B"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF CVV >= COMPMAXVAL AND P003 = "" THEN MOVMADE = "C"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF DVV >= COMPMAXVAL AND P004 = "" THEN MOVMADE = "D"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF EVV >= COMPMAXVAL AND P005 = "" THEN MOVMADE = "E"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF FVV >= COMPMAXVAL AND P006 = "" THEN MOVMADE = "F"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF GVV >= COMPMAXVAL AND P007 = "" THEN MOVMADE = "G"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF HVV >= COMPMAXVAL AND P008 = "" THEN MOVMADE = "H"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF IVV >= COMPMAXVAL AND P009 = "" THEN MOVMADE = "I"
COMPMAKEMOVE02:
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 2 AND COMP02MOVED = 1 THEN GOTO COMPUTER01
COMPMAXVAL = COMPMAXVAL - 1
GOTO COMPUTER02INPUT
COMP02RNDSTART:
LASTDRAWN = "": REM LAST DRAWN GAME FIRST MOVE! NOW MADE!
RANDOMIZE TIMER
COMP02RVAL = INT(RND * 10) + 1
IF COMP02RVAL = 1 AND P001 = "" THEN MOVMADE = "A"
IF COMP02RVAL = 2 AND P002 = "" THEN MOVMADE = "B"
IF COMP02RVAL = 3 AND P003 = "" THEN MOVMADE = "C"
IF COMP02RVAL = 4 AND P004 = "" THEN MOVMADE = "D"
IF COMP02RVAL = 5 AND P005 = "" THEN MOVMADE = "E"
IF COMP02RVAL = 6 AND P006 = "" THEN MOVMADE = "F"
IF COMP02RVAL = 7 AND P007 = "" THEN MOVMADE = "G"
IF COMP02RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP02RVAL = 9 AND P009 = "" THEN MOVMADE = "I"
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 2 AND COMP02MOVED = 1 THEN GOTO COMPUTER01
GOTO COMP02RNDSTART
REM-----------------------------------------------------------------------------------------------------------
GAMENDLEARN:
MOVSCTDWN = 13: REM MAX SCORE VALUE COUNT DOWN VARIABLE!
OXDATA$ = "O&XDATA.TXT"
OPEN OXDATA$ FOR APPEND AS #1: REM NOW LEARNT DATA SAVED!
REM BELOW (9) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN9
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN7
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 9 THEN GOTO MOVSLEARNEND
REM BELOW (8) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN8
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN6
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN4
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN2
IF MOVSCOUNT = 8 THEN GOTO MOVSLEARNEND
REM BELOW (7) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN7
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 7 THEN GOTO MOVSLEARNEND
REM BELOW (6) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN6
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN4
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN2
IF MOVSCOUNT = 6 THEN GOTO MOVSLEARNEND
REM BELOW (5) MOVES GAME PLAYED LEARNING BRANCHES!
REM NOTICE! QUICKEST WIN! POSSIBLE!
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 5 THEN GOTO MOVSLEARNEND
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN9: REM BELOW LEARN BLOCK (9) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN8: REM BELOW LEARN BLOCK (8) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN7: REM BELOW LEARN BLOCK (7) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN6: REM BELOW LEARN BLOCK (6) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN5: REM BELOW LEARN BLOCK (5) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN4: REM BELOW LEARN BLOCK (4) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN3: REM BELOW LEARN BLOCK (3) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN2: REM BELOW LEARN BLOCK (2) (2nd PLAYERS FIRST MOVE)!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP002N; "VV = "; MOVTYP002N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP002R; "VV = "; MOVTYP002R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN1: REM BELOW LEARN BLOCK (1) (1st PLAYERS FIRST MOVE)! EMPTY BOARD!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG000N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP000N; "VV = "; MOVTYP000N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG000R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP000R; "VV = "; MOVTYP000R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
MOVSLEARNEND:
CLOSE
REM-----------------------------------------------------------------------------------------------------------
RESTART:
IF GMOVERO = 1 THEN GOTO WINPRINTOUT
IF GMOVERX = 1 THEN GOTO WINPRINTOUT
PRINT "    ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW!"
GOTO NEWGAMEINPUT
WINPRINTOUT:
IF GMOVERO = 1 THEN PRINT "(O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS!"
IF GMOVERX = 1 THEN PRINT "(X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS!"
NEWGAMEINPUT:
PRINT
INPUT " PRESS (ENTER) FOR ANOTHER GAME! OR (QU) TO QUIT! "; QUIT$
IF QUIT$ = "QU" THEN END
IF QUIT$ = "qu" THEN END
RUN
GOTO NEWGAMEINPUT

SUB LEARNDATA1


END SUB



Reply
#2
Attached is the Program Playing against itself until it learns how to get it's first DRAW!
Which took (7) Games not bad! Smile

Below is the learning DATA which is in the Program version below.

Code:
IF MOVTYPN = "X" AND PTEMPVALN = "XOXOXOEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "OXOXOXEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXOXOEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOXOXEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXOXEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOXOEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "XOXOEEEEE" THEN  EVV = EVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "OXOXEEEEE" THEN  EVV = EVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXOEEEEE" THEN  EVV = EVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOXEEEEE" THEN  EVV = EVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEEEEEE" THEN  EVV = EVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEEEEEE" THEN  EVV = EVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "XOEEEEEEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "OXEEEEEEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "XOEEEEEEE" THEN  CVV = CVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "OXEEEEEEE" THEN  CVV = CVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN  CVV = CVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN  CVV = CVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  4 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  4 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXXOXOXE" THEN  IVV = IVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOOXOXOE" THEN  IVV = IVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXOXOXE" THEN  IVV = IVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOXOXOE" THEN  IVV = IVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXOXOEE" THEN  IVV = IVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOXOXEE" THEN  IVV = IVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXXOXEEE" THEN  GVV = GVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOOXOEEE" THEN  GVV = GVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXOXEEE" THEN  GVV = GVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOXOEEE" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXOEEEE" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOXEEEE" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXXEEEEE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOOEEEEE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXEEEEE" THEN  EVV = EVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOEEEEE" THEN  EVV = EVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEEEEE" THEN  EVV = EVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEEEEE" THEN  EVV = EVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEEEEEE" THEN  BVV = BVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEEEEEE" THEN  BVV = BVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEEEEEE" THEN  BVV = BVV +  3 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEEEEEE" THEN  BVV = BVV +  3 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN  BVV = BVV +  2 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN  BVV = BVV +  2 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  1 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  1 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXOXXEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOXOOEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOXXEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOXOOEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOXEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOXOEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXEXEEEE" THEN  DVV = DVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOEOEEEE" THEN  DVV = DVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEXEEEE" THEN  DVV = DVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEOEEEE" THEN  DVV = DVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEEEEE" THEN  DVV = DVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEEEEE" THEN  DVV = DVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEEEEEE" THEN  BVV = BVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEEEEEE" THEN  BVV = BVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEEEEEE" THEN  BVV = BVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEEEEEE" THEN  BVV = BVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN  BVV = BVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN  BVV = BVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "XOXXOOEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "OXOOXXEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXOOEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOXXEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXOEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOXEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "XOXEOEEEE" THEN  DVV = DVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "OXOEXEEEE" THEN  DVV = DVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEOEEEE" THEN  DVV = DVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEXEEEE" THEN  DVV = DVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEEEEEE" THEN  DVV = DVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEEEEEE" THEN  DVV = DVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "XOEEEEEEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "OXEEEEEEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "XOEEEEEEE" THEN  CVV = CVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "OXEEEEEEE" THEN  CVV = CVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN  CVV = CVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN  CVV = CVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  4 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOOXXOOE" THEN  IVV = IVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXXOOXXE" THEN  IVV = IVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOXXOOE" THEN  IVV = IVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXOOXXE" THEN  IVV = IVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOXXOEE" THEN  IVV = IVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXOOXEE" THEN  IVV = IVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOOXEOEE" THEN  FVV = FVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXXOEXEE" THEN  FVV = FVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOXEOEE" THEN  FVV = FVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXOEXEE" THEN  FVV = FVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOXEEEE" THEN  FVV = FVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXOEEEE" THEN  FVV = FVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOOEEEEE" THEN  EVV = EVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXXEEEEE" THEN  EVV = EVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOEEEEE" THEN  EVV = EVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXEEEEE" THEN  EVV = EVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEEEEE" THEN  EVV = EVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEEEEE" THEN  EVV = EVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEEEEEE" THEN  BVV = BVV +  4 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEEEEEE" THEN  BVV = BVV +  4 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEEEEEE" THEN  BVV = BVV +  3 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEEEEEE" THEN  BVV = BVV +  3 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN  BVV = BVV +  2 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN  BVV = BVV +  2 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  1 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  AVV = AVV +  1 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOXEEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOXOEEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEXEEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEOEEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXEXEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOEOEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEEEEE" THEN  EVV = EVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEEEEE" THEN  EVV = EVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEEEEEE" THEN  EVV = EVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEEEEEE" THEN  EVV = EVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEEEEEE" THEN  EVV = EVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEEEEEE" THEN  EVV = EVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOXEEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOXOEEEE" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEXEEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEOEEEE" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OOXEXEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "XXOEOEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEEEEE" THEN  EVV = EVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEEEEE" THEN  EVV = EVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEEEEEE" THEN  EVV = EVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEEEEEE" THEN  EVV = EVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEEEEEE" THEN  EVV = EVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEEEEEE" THEN  EVV = EVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN  CVV = CVV +  7 
Anthony.
Reply
#3
Anthony,

Wow! Another great and fun AI game! Thank you! I have played it many times (lost count actually), adding data to the source, deleting the file, and played some more until the computer either times with me or I loose.

Great learning skills.

Here is your source code for the game along with the game data that I collected.

Code:
DECLARE SUB LEARNDATA1 ()

DIM SHARED LASTDRAWN AS STRING
DIM SHARED COMP01RVAL AS INTEGER
DIM SHARED COMP02RVAL AS INTEGER
DIM SHARED GAMETYP AS INTEGER
DIM SHARED WHOMFST AS STRING
DIM SHARED MOVTYPN AS STRING
DIM SHARED MOVTYPR AS STRING
DIM SHARED MOVMADE AS STRING
DIM SHARED HUMANMOVED AS INTEGER
DIM SHARED COMP01MOVED AS INTEGER
DIM SHARED COMP02MOVED AS INTEGER
DIM SHARED COMPMAXVAL AS LONG
DIM SHARED AVV AS INTEGER
DIM SHARED BVV AS INTEGER
DIM SHARED CVV AS INTEGER
DIM SHARED DVV AS INTEGER
DIM SHARED EVV AS INTEGER
DIM SHARED FVV AS INTEGER
DIM SHARED GVV AS INTEGER
DIM SHARED HVV AS INTEGER
DIM SHARED IVV AS INTEGER
DIM SHARED P001 AS STRING
DIM SHARED P002 AS STRING
DIM SHARED P003 AS STRING
DIM SHARED P004 AS STRING
DIM SHARED P005 AS STRING
DIM SHARED P006 AS STRING
DIM SHARED P007 AS STRING
DIM SHARED P008 AS STRING
DIM SHARED P009 AS STRING
DIM SHARED P001VN AS STRING
DIM SHARED P002VN AS STRING
DIM SHARED P003VN AS STRING
DIM SHARED P004VN AS STRING
DIM SHARED P005VN AS STRING
DIM SHARED P006VN AS STRING
DIM SHARED P007VN AS STRING
DIM SHARED P008VN AS STRING
DIM SHARED P009VN AS STRING
DIM SHARED P001VR AS STRING
DIM SHARED P002VR AS STRING
DIM SHARED P003VR AS STRING
DIM SHARED P004VR AS STRING
DIM SHARED P005VR AS STRING
DIM SHARED P006VR AS STRING
DIM SHARED P007VR AS STRING
DIM SHARED P008VR AS STRING
DIM SHARED P009VR AS STRING
DIM SHARED PTEMPVALN AS STRING
DIM SHARED PTEMPVALR AS STRING
DIM SHARED MOVTYP000N AS STRING
DIM SHARED MOVTYP001N AS STRING
DIM SHARED MOVTYP002N AS STRING
DIM SHARED MOVTYP003N AS STRING
DIM SHARED MOVTYP004N AS STRING
DIM SHARED MOVTYP005N AS STRING
DIM SHARED MOVTYP006N AS STRING
DIM SHARED MOVTYP007N AS STRING
DIM SHARED MOVTYP008N AS STRING
DIM SHARED MOVTYP009N AS STRING
DIM SHARED MOVTYP000R AS STRING
DIM SHARED MOVTYP001R AS STRING
DIM SHARED MOVTYP002R AS STRING
DIM SHARED MOVTYP003R AS STRING
DIM SHARED MOVTYP004R AS STRING
DIM SHARED MOVTYP005R AS STRING
DIM SHARED MOVTYP006R AS STRING
DIM SHARED MOVTYP007R AS STRING
DIM SHARED MOVTYP008R AS STRING
DIM SHARED MOVTYP009R AS STRING
DIM SHARED MOVREG000N AS STRING
DIM SHARED MOVREG001N AS STRING
DIM SHARED MOVREG002N AS STRING
DIM SHARED MOVREG003N AS STRING
DIM SHARED MOVREG004N AS STRING
DIM SHARED MOVREG005N AS STRING
DIM SHARED MOVREG006N AS STRING
DIM SHARED MOVREG007N AS STRING
DIM SHARED MOVREG008N AS STRING
DIM SHARED MOVREG009N AS STRING
DIM SHARED MOVREG000R AS STRING
DIM SHARED MOVREG001R AS STRING
DIM SHARED MOVREG002R AS STRING
DIM SHARED MOVREG003R AS STRING
DIM SHARED MOVREG004R AS STRING
DIM SHARED MOVREG005R AS STRING
DIM SHARED MOVREG006R AS STRING
DIM SHARED MOVREG007R AS STRING
DIM SHARED MOVREG008R AS STRING
DIM SHARED MOVREG009R AS STRING
DIM SHARED MOVSCOUNT AS INTEGER
DIM SHARED MOVSCTDWN AS INTEGER
DIM SHARED WLINE001 AS STRING
DIM SHARED WLINE002 AS STRING
DIM SHARED WLINE003 AS STRING
DIM SHARED WLINE004 AS STRING
DIM SHARED WLINE005 AS STRING
DIM SHARED WLINE006 AS STRING
DIM SHARED WLINE007 AS STRING
DIM SHARED WLINE008 AS STRING
DIM SHARED GMOVERO AS INTEGER
DIM SHARED GMOVERX AS INTEGER
DIM SHARED GMOVERD AS INTEGER
DIM SHARED DRAWNSAVEDONE AS INTEGER
SCREEN 11
REM-----------------------------------------------------------------------------------------------------------
CLS
PRINT: PRINT
PRINT TAB(11); "OXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXO"
PRINT: PRINT
PRINT TAB(90); "         { OXAUTOLN2 } O&X AUTO SELF LEARNING PROGRAM!  "
PRINT: PRINT
PRINT TAB(90); "       ORIGINAL-V1.23/02/2002 THIS VERSION-V2.06/12/2012 "
PRINT: PRINT
PRINT TAB(90); "          LEARNING NOW APPEND SAVED! INTO O&XDATA.TXT "
PRINT: PRINT
PRINT TAB(90); "     COPY & PASTE INTO SUB LEARNDATA1 AT PROGRAM END & SAVE! "
PRINT: PRINT
PRINT TAB(90); "           THEN DELETE O&XDATA.TXT FOR NEW LEARNING!  "
PRINT: PRINT
PRINT TAB(90); "                 BY, [A][R][B] COMPUTER SOFTWARE. "
PRINT: PRINT
PRINT TAB(11); "OXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXO"
PRINT: PRINT
INPUT " PRESS (ENTER) TO START PROGRAM! "; XYZ$
LASTDRAWNINPUT:
CLS
PRINT: PRINT
INPUT " WAS THE LAST GAME A DRAWN GAME! ENTER (Y) OR (N) "; LASTDRAWN
IF LASTDRAWN = "y" THEN LASTDRAWN = "Y"
IF LASTDRAWN = "n" THEN LASTDRAWN = "N"
IF LASTDRAWN = "Y" THEN GOTO START
IF LASTDRAWN = "N" THEN GOTO START
GOTO LASTDRAWNINPUT
REM-----------------------------------------------------------------------------------------------------------
START:
CLS
REM BELOW GIVE MAIN BOARD REGISTER START VARIABLES! A STRING EMPTY SQUARE VALUE!
P001VN = "E": P002VN = "E": P003VN = "E"
P004VN = "E": P005VN = "E": P006VN = "E"
P007VN = "E": P008VN = "E": P009VN = "E"
PTEMPVALN = P001VN + P002VN + P003VN + P004VN + P005VN + P006VN + P007VN + P008VN + P009VN
REM BELOW REVERSE LEARNING BOARD REGISTER START VARIABLES!
P001VR = "E": P002VR = "E": P003VR = "E"
P004VR = "E": P005VR = "E": P006VR = "E"
P007VR = "E": P008VR = "E": P009VR = "E"
PTEMPVALR = P001VR + P002VR + P003VR + P004VR + P005VR + P006VR + P007VR + P008VR + P009VR
PRINT: PRINT
INPUT " ENTER GAME TYPE!  HUMAN V COMPUTER = 1  COMPUTER V COMPUTER = 2  "; GAMETYP
IF GAMETYP = 1 THEN GOTO WHOMOVESFIRST
IF GAMETYP = 2 THEN GOTO COMPRANDOMSTART
GOTO START
REM-----------------------------------------------------------------------------------------------------------
WHOMOVESFIRST:
CLS
PRINT: PRINT
INPUT " ENTER WHO MOVES FIRST!  HUMAN = (O)  COMPUTER = (X)  "; WHOMFST
IF WHOMFST = "o" THEN WHOMFST = "O"
IF WHOMFST = "x" THEN WHOMFST = "X"
IF WHOMFST = "O" THEN MOVTYPN = ""
IF WHOMFST = "O" THEN GOSUB BOARD
IF WHOMFST = "O" THEN GOTO HUMAN
IF WHOMFST = "X" THEN MOVTYPN = ""
IF WHOMFST = "X" THEN GOSUB BOARD
IF WHOMFST = "X" THEN GOTO COMPUTER01
GOTO WHOMOVESFIRST
REM-----------------------------------------------------------------------------------------------------------
COMPRANDOMSTART:
RANDOMIZE TIMER
COMPRAND12 = INT(RND * 100) + 1
IF COMPRAND12 < 50 THEN MOVTYPN = ""
IF COMPRAND12 < 50 THEN GOSUB BOARD
IF COMPRAND12 < 50 THEN GOTO COMPUTER01
IF COMPRAND12 > 50 THEN MOVTYPN = ""
IF COMPRAND12 > 50 THEN GOSUB BOARD
IF COMPRAND12 > 50 THEN GOTO COMPUTER02
GOTO COMPRANDOMSTART
REM-----------------------------------------------------------------------------------------------------------
BOARD:
CLS
REM BELOW PRINT ALL MOVES MADE ONTO THE BOARD!
IF MOVMADE = "A" AND P001 = "" THEN P001 = MOVTYPN
IF MOVMADE = "B" AND P002 = "" THEN P002 = MOVTYPN
IF MOVMADE = "C" AND P003 = "" THEN P003 = MOVTYPN
IF MOVMADE = "D" AND P004 = "" THEN P004 = MOVTYPN
IF MOVMADE = "E" AND P005 = "" THEN P005 = MOVTYPN
IF MOVMADE = "F" AND P006 = "" THEN P006 = MOVTYPN
IF MOVMADE = "G" AND P007 = "" THEN P007 = MOVTYPN
IF MOVMADE = "H" AND P008 = "" THEN P008 = MOVTYPN
IF MOVMADE = "I" AND P009 = "" THEN P009 = MOVTYPN
PRINT: PRINT: PRINT: PRINT
PRINT TAB(20); "(A)= "; P001; TAB(40); "(B)= "; P002; TAB(60); "(C)= "; P003
PRINT: PRINT: PRINT: PRINT: PRINT
PRINT TAB(20); "(D)= "; P004; TAB(40); "(E)= "; P005; TAB(60); "(F)= "; P006
PRINT: PRINT: PRINT: PRINT: PRINT
PRINT TAB(20); "(G)= "; P007; TAB(40); "(H)= "; P008; TAB(60); "(I)= "; P009
PRINT: PRINT: PRINT: PRINT
IF MOVTYPN = "" THEN RETURN: REM BACK TO HUMAN (NO INPUT) OR COMPUTERS AT RANDOM START!
REM BELOW MAIN BOARD POSITION! MOVE REGISTER VARIABLES!
IF P001 <> "" AND P001VN = "E" THEN P001VN = MOVTYPN
IF P002 <> "" AND P002VN = "E" THEN P002VN = MOVTYPN
IF P003 <> "" AND P003VN = "E" THEN P003VN = MOVTYPN
IF P004 <> "" AND P004VN = "E" THEN P004VN = MOVTYPN
IF P005 <> "" AND P005VN = "E" THEN P005VN = MOVTYPN
IF P006 <> "" AND P006VN = "E" THEN P006VN = MOVTYPN
IF P007 <> "" AND P007VN = "E" THEN P007VN = MOVTYPN
IF P008 <> "" AND P008VN = "E" THEN P008VN = MOVTYPN
IF P009 <> "" AND P009VN = "E" THEN P009VN = MOVTYPN
REM BELOW MAIN BOARD POSITION! MOVE REGISTER REVERSE VARIABLES!
REM BELOW SET TYPE(R) VARIABLES FOR REVERSE MOVES LEARNING!
IF MOVTYPN = "O" THEN MOVTYPR = "X"
IF MOVTYPN = "X" THEN MOVTYPR = "O"
IF P001 <> "" AND P001VR = "E" THEN P001VR = MOVTYPR
IF P002 <> "" AND P002VR = "E" THEN P002VR = MOVTYPR
IF P003 <> "" AND P003VR = "E" THEN P003VR = MOVTYPR
IF P004 <> "" AND P004VR = "E" THEN P004VR = MOVTYPR
IF P005 <> "" AND P005VR = "E" THEN P005VR = MOVTYPR
IF P006 <> "" AND P006VR = "E" THEN P006VR = MOVTYPR
IF P007 <> "" AND P007VR = "E" THEN P007VR = MOVTYPR
IF P008 <> "" AND P008VR = "E" THEN P008VR = MOVTYPR
IF P009 <> "" AND P009VR = "E" THEN P009VR = MOVTYPR
REM-----------------------------------------------------------------------------------------------------------
REM BELOW MAIN BOARD POSITIONS! NORMAL AND REVERSE LEARNING REGISTER VARIABLES!
PTEMPVALN = P001VN + P002VN + P003VN + P004VN + P005VN + P006VN + P007VN + P008VN + P009VN
PTEMPVALR = P001VR + P002VR + P003VR + P004VR + P005VR + P006VR + P007VR + P008VR + P009VR
MOVREGISTER000: REM BELOW MOVE (0) NORMAL AND REVERSE MOVE REGISTERS!
REM NOTICE!! THIS IS THE FIRST BEST MOVE EMPTY BOARD REGISTER! SO DIFFERENT!
IF MOVREG000N <> "" THEN GOTO MOVREGISTER001
MOVREG000N = "EEEEEEEEE": MOVTYP000N = MOVMADE
MOVREG000R = "EEEEEEEEE": MOVTYP000R = MOVMADE
REM NOTICE!! NO IMMEDIATE BRANCH TO (WINCHECKS) AS BOTH FIRST (2) REGISTERS DONE AT SAME TIME!
MOVREGISTER001: REM BELOW MOVE (1) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG001N <> "" THEN GOTO MOVREGISTER002
MOVSCOUNT = MOVSCOUNT + 1
MOVREG001N = PTEMPVALN: MOVTYP001N = MOVMADE
MOVREG001R = PTEMPVALR: MOVTYP001R = MOVMADE
GOTO WINCHECKS
MOVREGISTER002: REM BELOW MOVE (2) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG002N <> "" THEN GOTO MOVREGISTER003
MOVSCOUNT = MOVSCOUNT + 1
MOVREG002N = PTEMPVALN: MOVTYP002N = MOVMADE
MOVREG002R = PTEMPVALR: MOVTYP002R = MOVMADE
GOTO WINCHECKS
MOVREGISTER003: REM BELOW MOVE (3) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG003N <> "" THEN GOTO MOVREGISTER004
MOVSCOUNT = MOVSCOUNT + 1
MOVREG003N = PTEMPVALN: MOVTYP003N = MOVMADE
MOVREG003R = PTEMPVALR: MOVTYP003R = MOVMADE
GOTO WINCHECKS
MOVREGISTER004: REM BELOW MOVE (4) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG004N <> "" THEN GOTO MOVREGISTER005
MOVSCOUNT = MOVSCOUNT + 1
MOVREG004N = PTEMPVALN: MOVTYP004N = MOVMADE
MOVREG004R = PTEMPVALR: MOVTYP004R = MOVMADE
GOTO WINCHECKS
MOVREGISTER005: REM BELOW MOVE (5) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG005N <> "" THEN GOTO MOVREGISTER006
MOVSCOUNT = MOVSCOUNT + 1
MOVREG005N = PTEMPVALN: MOVTYP005N = MOVMADE
MOVREG005R = PTEMPVALR: MOVTYP005R = MOVMADE
GOTO WINCHECKS
MOVREGISTER006: REM BELOW MOVE (6) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG006N <> "" THEN GOTO MOVREGISTER007
MOVSCOUNT = MOVSCOUNT + 1
MOVREG006N = PTEMPVALN: MOVTYP006N = MOVMADE
MOVREG006R = PTEMPVALR: MOVTYP006R = MOVMADE
GOTO WINCHECKS
MOVREGISTER007: REM BELOW MOVE (7) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG007N <> "" THEN GOTO MOVREGISTER008
MOVSCOUNT = MOVSCOUNT + 1
MOVREG007N = PTEMPVALN: MOVTYP007N = MOVMADE
MOVREG007R = PTEMPVALR: MOVTYP007R = MOVMADE
GOTO WINCHECKS
MOVREGISTER008: REM BELOW MOVE (8) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG008N <> "" THEN GOTO MOVREGISTER009
MOVSCOUNT = MOVSCOUNT + 1
MOVREG008N = PTEMPVALN: MOVTYP008N = MOVMADE
MOVREG008R = PTEMPVALR: MOVTYP008R = MOVMADE
GOTO WINCHECKS
MOVREGISTER009: REM BELOW MOVE (9) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG009N <> "" THEN GOTO WINCHECKS
MOVSCOUNT = MOVSCOUNT + 1
MOVREG009N = PTEMPVALN: MOVTYP009N = MOVMADE
MOVREG009R = PTEMPVALR: MOVTYP009R = MOVMADE
REM-----------------------------------------------------------------------------------------------------------
WINCHECKS: REM BELOW CHECK IF ANY OF THE (8) WINNING LINES HAVE BEEN MADE!
WLINE001 = P001 + P002 + P003
WLINE002 = P004 + P005 + P006
WLINE003 = P007 + P008 + P009
WLINE004 = P001 + P004 + P007
WLINE005 = P002 + P005 + P008
WLINE006 = P003 + P006 + P009
WLINE007 = P001 + P005 + P009
WLINE008 = P003 + P005 + P007
IF WLINE001 = "OOO" THEN GMOVERO = 1
IF WLINE002 = "OOO" THEN GMOVERO = 1
IF WLINE003 = "OOO" THEN GMOVERO = 1
IF WLINE004 = "OOO" THEN GMOVERO = 1
IF WLINE005 = "OOO" THEN GMOVERO = 1
IF WLINE006 = "OOO" THEN GMOVERO = 1
IF WLINE007 = "OOO" THEN GMOVERO = 1
IF WLINE008 = "OOO" THEN GMOVERO = 1
IF WLINE001 = "XXX" THEN GMOVERX = 1
IF WLINE002 = "XXX" THEN GMOVERX = 1
IF WLINE003 = "XXX" THEN GMOVERX = 1
IF WLINE004 = "XXX" THEN GMOVERX = 1
IF WLINE005 = "XXX" THEN GMOVERX = 1
IF WLINE006 = "XXX" THEN GMOVERX = 1
IF WLINE007 = "XXX" THEN GMOVERX = 1
IF WLINE008 = "XXX" THEN GMOVERX = 1
REM BELOW CHECK IF ALL MOVES HAVE BEEN MADE!
IF MOVSCOUNT >= 9 THEN GMOVERD = 1
REM BELOW REGISTER WHO HAS JUST MADE A MOVE!
IF GAMETYP = 1 AND MOVTYPN = "O" THEN HUMANMOVED = 1
IF GAMETYP = 1 AND MOVTYPN = "X" THEN COMP01MOVED = 1
IF GAMETYP = 2 AND MOVTYPN = "X" THEN COMP01MOVED = 1
IF GAMETYP = 2 AND MOVTYPN = "O" THEN COMP02MOVED = 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
HUMAN:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
HUMANMOVED = 0
HUMANINPUT:
MOVMADE = ""
MOVTYPN = "O"
INPUT " HUMANS MOVE! ENTER THE LETTER (A - I) FOR YOUR MOVE!  "; MOVMADE
IF MOVMADE = "a" THEN MOVMADE = "A"
IF MOVMADE = "b" THEN MOVMADE = "B"
IF MOVMADE = "c" THEN MOVMADE = "C"
IF MOVMADE = "d" THEN MOVMADE = "D"
IF MOVMADE = "e" THEN MOVMADE = "E"
IF MOVMADE = "f" THEN MOVMADE = "F"
IF MOVMADE = "g" THEN MOVMADE = "G"
IF MOVMADE = "h" THEN MOVMADE = "H"
IF MOVMADE = "i" THEN MOVMADE = "I"
IF MOVMADE = "A" AND P001 = "" THEN GOSUB BOARD
IF MOVMADE = "B" AND P002 = "" THEN GOSUB BOARD
IF MOVMADE = "C" AND P003 = "" THEN GOSUB BOARD
IF MOVMADE = "D" AND P004 = "" THEN GOSUB BOARD
IF MOVMADE = "E" AND P005 = "" THEN GOSUB BOARD
IF MOVMADE = "F" AND P006 = "" THEN GOSUB BOARD
IF MOVMADE = "G" AND P007 = "" THEN GOSUB BOARD
IF MOVMADE = "H" AND P008 = "" THEN GOSUB BOARD
IF MOVMADE = "I" AND P009 = "" THEN GOSUB BOARD
IF GAMETYP = 1 AND HUMANMOVED = 1 THEN GOTO COMPUTER01
MOVTYPN = "": REM MAKES RETURN FROM BOARD WORK! AS NO MOVE INPUT MADE!
GOSUB BOARD
GOTO HUMANINPUT
REM-----------------------------------------------------------------------------------------------------------
COMPUTER01:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
COMP01MOVED = 0
MOVMADE = ""
MOVTYPN = "X"
PRINT " COMPUTER01 THINKING!........................................................."
CALL LEARNDATA1: REM CALL MAIN LEARNING DATA SUBS FOR BEST MOVE VALUES!
COMPMAXVAL = 1000000
IF LASTDRAWN = "Y" THEN GOTO COMP01RNDSTART
COMPUTER01INPUT:
IF AVV >= COMPMAXVAL AND P001 = "" THEN MOVMADE = "A"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF BVV >= COMPMAXVAL AND P002 = "" THEN MOVMADE = "B"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF CVV >= COMPMAXVAL AND P003 = "" THEN MOVMADE = "C"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF DVV >= COMPMAXVAL AND P004 = "" THEN MOVMADE = "D"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF EVV >= COMPMAXVAL AND P005 = "" THEN MOVMADE = "E"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF FVV >= COMPMAXVAL AND P006 = "" THEN MOVMADE = "F"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF GVV >= COMPMAXVAL AND P007 = "" THEN MOVMADE = "G"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF HVV >= COMPMAXVAL AND P008 = "" THEN MOVMADE = "H"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF IVV >= COMPMAXVAL AND P009 = "" THEN MOVMADE = "I"
COMPMAKEMOVE01:
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 1 AND COMP01MOVED = 1 THEN GOTO HUMAN
IF GAMETYP = 2 AND COMP01MOVED = 1 THEN GOTO COMPUTER02
COMPMAXVAL = COMPMAXVAL - 1
GOTO COMPUTER01INPUT
COMP01RNDSTART:
LASTDRAWN = "": REM LAST DRAWN GAME FIRST MOVE! NOW MADE!
RANDOMIZE TIMER
COMP01RVAL = INT(RND * 10) + 1
IF COMP01RVAL = 1 AND P001 = "" THEN MOVMADE = "A"
IF COMP01RVAL = 2 AND P002 = "" THEN MOVMADE = "B"
IF COMP01RVAL = 3 AND P003 = "" THEN MOVMADE = "C"
IF COMP01RVAL = 4 AND P004 = "" THEN MOVMADE = "D"
IF COMP01RVAL = 5 AND P005 = "" THEN MOVMADE = "E"
IF COMP01RVAL = 6 AND P006 = "" THEN MOVMADE = "F"
IF COMP01RVAL = 7 AND P007 = "" THEN MOVMADE = "G"
IF COMP01RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP01RVAL = 9 AND P009 = "" THEN MOVMADE = "I"
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 1 AND COMP01MOVED = 1 THEN GOTO HUMAN
IF GAMETYP = 2 AND COMP01MOVED = 1 THEN GOTO COMPUTER02
GOTO COMP01RNDSTART
REM-----------------------------------------------------------------------------------------------------------
COMPUTER02:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
COMP02MOVED = 0
MOVMADE = ""
MOVTYPN = "O"
PRINT " COMPUTER02 THINKING!........................................................."
CALL LEARNDATA1: REM CALL MAIN LEARNING DATA SUBS FOR BEST MOVE VALUES!
COMPMAXVAL = 1000000
IF LASTDRAWN = "Y" THEN GOTO COMP02RNDSTART
COMPUTER02INPUT:
IF AVV >= COMPMAXVAL AND P001 = "" THEN MOVMADE = "A"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF BVV >= COMPMAXVAL AND P002 = "" THEN MOVMADE = "B"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF CVV >= COMPMAXVAL AND P003 = "" THEN MOVMADE = "C"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF DVV >= COMPMAXVAL AND P004 = "" THEN MOVMADE = "D"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF EVV >= COMPMAXVAL AND P005 = "" THEN MOVMADE = "E"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF FVV >= COMPMAXVAL AND P006 = "" THEN MOVMADE = "F"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF GVV >= COMPMAXVAL AND P007 = "" THEN MOVMADE = "G"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF HVV >= COMPMAXVAL AND P008 = "" THEN MOVMADE = "H"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF IVV >= COMPMAXVAL AND P009 = "" THEN MOVMADE = "I"
COMPMAKEMOVE02:
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 2 AND COMP02MOVED = 1 THEN GOTO COMPUTER01
COMPMAXVAL = COMPMAXVAL - 1
GOTO COMPUTER02INPUT
COMP02RNDSTART:
LASTDRAWN = "": REM LAST DRAWN GAME FIRST MOVE! NOW MADE!
RANDOMIZE TIMER
COMP02RVAL = INT(RND * 10) + 1
IF COMP02RVAL = 1 AND P001 = "" THEN MOVMADE = "A"
IF COMP02RVAL = 2 AND P002 = "" THEN MOVMADE = "B"
IF COMP02RVAL = 3 AND P003 = "" THEN MOVMADE = "C"
IF COMP02RVAL = 4 AND P004 = "" THEN MOVMADE = "D"
IF COMP02RVAL = 5 AND P005 = "" THEN MOVMADE = "E"
IF COMP02RVAL = 6 AND P006 = "" THEN MOVMADE = "F"
IF COMP02RVAL = 7 AND P007 = "" THEN MOVMADE = "G"
IF COMP02RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP02RVAL = 9 AND P009 = "" THEN MOVMADE = "I"
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 2 AND COMP02MOVED = 1 THEN GOTO COMPUTER01
GOTO COMP02RNDSTART
REM-----------------------------------------------------------------------------------------------------------
GAMENDLEARN:
MOVSCTDWN = 13: REM MAX SCORE VALUE COUNT DOWN VARIABLE!
OXDATA$ = "O&XDATA.TXT"
OPEN OXDATA$ FOR APPEND AS #1: REM NOW LEARNT DATA SAVED!
REM BELOW (9) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN9
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN7
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 9 THEN GOTO MOVSLEARNEND
REM BELOW (8) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN8
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN6
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN4
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN2
IF MOVSCOUNT = 8 THEN GOTO MOVSLEARNEND
REM BELOW (7) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN7
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 7 THEN GOTO MOVSLEARNEND
REM BELOW (6) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN6
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN4
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN2
IF MOVSCOUNT = 6 THEN GOTO MOVSLEARNEND
REM BELOW (5) MOVES GAME PLAYED LEARNING BRANCHES!
REM NOTICE! QUICKEST WIN! POSSIBLE!
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 5 THEN GOTO MOVSLEARNEND
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN9: REM BELOW LEARN BLOCK (9) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN8: REM BELOW LEARN BLOCK (8) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN7: REM BELOW LEARN BLOCK (7) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN6: REM BELOW LEARN BLOCK (6) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN5: REM BELOW LEARN BLOCK (5) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN4: REM BELOW LEARN BLOCK (4) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN3: REM BELOW LEARN BLOCK (3) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN2: REM BELOW LEARN BLOCK (2) (2nd PLAYERS FIRST MOVE)!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP002N; "VV = "; MOVTYP002N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP002R; "VV = "; MOVTYP002R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN1: REM BELOW LEARN BLOCK (1) (1st PLAYERS FIRST MOVE)! EMPTY BOARD!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG000N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP000N; "VV = "; MOVTYP000N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG000R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP000R; "VV = "; MOVTYP000R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
MOVSLEARNEND:
CLOSE
REM-----------------------------------------------------------------------------------------------------------
RESTART:
IF GMOVERO = 1 THEN GOTO WINPRINTOUT
IF GMOVERX = 1 THEN GOTO WINPRINTOUT
PRINT "    ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW!"
GOTO NEWGAMEINPUT
WINPRINTOUT:
IF GMOVERO = 1 THEN PRINT "(O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS!"
IF GMOVERX = 1 THEN PRINT "(X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS!"
NEWGAMEINPUT:
PRINT
INPUT " PRESS (ENTER) FOR ANOTHER GAME! OR (QU) TO QUIT! "; QUIT$
IF QUIT$ = "QU" THEN END
IF QUIT$ = "qu" THEN END
RUN
GOTO NEWGAMEINPUT



SUB LEARNDATA1

IF MOVTYPN = "O" AND PTEMPVALN = "XXOXXEOEO" THEN HVV = HVV + 13
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOOEXEX" THEN HVV = HVV + 13
IF MOVTYPN = "O" AND PTEMPVALN = "XXOXEEOEO" THEN HVV = HVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOEEXEX" THEN HVV = HVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "XXOXEEOEO" THEN HVV = HVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "OOXOEEXEX" THEN HVV = HVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "XXOXEEOEE" THEN IVV = IVV + 10
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOEEXEE" THEN IVV = IVV + 10
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEEOEE" THEN IVV = IVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEEXEE" THEN IVV = IVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "XXOEEEOEE" THEN IVV = IVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "OOXEEEXEE" THEN IVV = IVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "XXEEEEOEE" THEN CVV = CVV + 7
IF MOVTYPN = "X" AND PTEMPVALN = "OOEEEEXEE" THEN CVV = CVV + 7
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEOEE" THEN CVV = CVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEXEE" THEN CVV = CVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEEEOEE" THEN CVV = CVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEEEXEE" THEN CVV = CVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN GVV = GVV + 4
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN GVV = GVV + 4
IF MOVTYPN = "O" AND PTEMPVALN = "XXOXEEOEE" THEN EVV = EVV + 13
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOEEXEE" THEN EVV = EVV + 13
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEEOEE" THEN EVV = EVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEEXEE" THEN EVV = EVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "XXOEEEOEE" THEN EVV = EVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "OOXEEEXEE" THEN EVV = EVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "XXEEEEOEE" THEN CVV = CVV + 10
IF MOVTYPN = "X" AND PTEMPVALN = "OOEEEEXEE" THEN CVV = CVV + 10
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEOEE" THEN CVV = CVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEXEE" THEN CVV = CVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEEEOEE" THEN CVV = CVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEEEXEE" THEN CVV = CVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN GVV = GVV + 7
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN GVV = GVV + 7
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXXEOOE" THEN IVV = IVV + 13
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOOEXXE" THEN IVV = IVV + 13
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXEEOOE" THEN IVV = IVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOEEXXE" THEN IVV = IVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "XOXXEEOOE" THEN IVV = IVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "OXOOEEXXE" THEN IVV = IVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXEEOEE" THEN HVV = HVV + 10
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOEEXEE" THEN HVV = HVV + 10
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEEEOEE" THEN HVV = HVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEEEXEE" THEN HVV = HVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "XOXEEEOEE" THEN HVV = HVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "OXOEEEXEE" THEN HVV = HVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEEEOEE" THEN BVV = BVV + 7
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEEEXEE" THEN BVV = BVV + 7
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEOEE" THEN BVV = BVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEXEE" THEN BVV = BVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEEEOEE" THEN BVV = BVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEEEXEE" THEN BVV = BVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN GVV = GVV + 4
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN GVV = GVV + 4
IF MOVTYPN = "O" AND PTEMPVALN = "XXOXEEEEO" THEN FVV = FVV + 13
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOEEEEX" THEN FVV = FVV + 13
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEEEEO" THEN FVV = FVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEEEEX" THEN FVV = FVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "XXOEEEEEO" THEN FVV = FVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "OOXEEEEEX" THEN FVV = FVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "XXEEEEEEO" THEN CVV = CVV + 10
IF MOVTYPN = "X" AND PTEMPVALN = "OOEEEEEEX" THEN CVV = CVV + 10
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEO" THEN CVV = CVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEX" THEN CVV = CVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEEEEEO" THEN CVV = CVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEEEEEX" THEN CVV = CVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN IVV = IVV + 7
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN IVV = IVV + 7
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXXEOEO" THEN HVV = HVV + 13
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOOEXEX" THEN HVV = HVV + 13
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXEEOEO" THEN HVV = HVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOEEXEX" THEN HVV = HVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "XOXXEEOEO" THEN HVV = HVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "OXOOEEXEX" THEN HVV = HVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXEEEEO" THEN GVV = GVV + 10
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOEEEEX" THEN GVV = GVV + 10
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEEEEEO" THEN GVV = GVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEEEEEX" THEN GVV = GVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "XOXEEEEEO" THEN GVV = GVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "OXOEEEEEX" THEN GVV = GVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEEEEEO" THEN BVV = BVV + 7
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEEEEEX" THEN BVV = BVV + 7
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEO" THEN BVV = BVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEX" THEN BVV = BVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEEEEEO" THEN BVV = BVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEEEEEX" THEN BVV = BVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN IVV = IVV + 4
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN IVV = IVV + 4
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXXEOEO" THEN HVV = HVV + 13
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOOEXEX" THEN HVV = HVV + 13
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXEEOEO" THEN HVV = HVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOEEXEX" THEN HVV = HVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "XOXXEEOEO" THEN HVV = HVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "OXOOEEXEX" THEN HVV = HVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "XOXXEEEEO" THEN GVV = GVV + 10
IF MOVTYPN = "X" AND PTEMPVALN = "OXOOEEEEX" THEN GVV = GVV + 10
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEEEEEO" THEN GVV = GVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEEEEEX" THEN GVV = GVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "XOXEEEEEO" THEN GVV = GVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "OXOEEEEEX" THEN GVV = GVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEEEEEO" THEN BVV = BVV + 7
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEEEEEX" THEN BVV = BVV + 7
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEO" THEN BVV = BVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEX" THEN BVV = BVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEEEEEO" THEN BVV = BVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEEEEEX" THEN BVV = BVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN IVV = IVV + 4
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN IVV = IVV + 4
IF MOVTYPN = "X" AND PTEMPVALN = "XOXEOEXEO" THEN DVV = DVV + 13
IF MOVTYPN = "O" AND PTEMPVALN = "OXOEXEOEX" THEN DVV = DVV + 13
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEOEXEO" THEN DVV = DVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEXEOEX" THEN DVV = DVV + 12
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEEEXEO" THEN DVV = DVV + 11
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEEEOEX" THEN DVV = DVV + 11
IF MOVTYPN = "X" AND PTEMPVALN = "XOXEEEEEO" THEN GVV = GVV + 10
IF MOVTYPN = "O" AND PTEMPVALN = "OXOEEEEEX" THEN GVV = GVV + 10
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEEEEEO" THEN GVV = GVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEEEEEX" THEN GVV = GVV + 9
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEEEEEO" THEN GVV = GVV + 8
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEEEEEX" THEN GVV = GVV + 8
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEEEEEO" THEN CVV = CVV + 7
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEEEEEX" THEN CVV = CVV + 7
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEO" THEN CVV = CVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEX" THEN CVV = CVV + 6
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN CVV = CVV + 5
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN CVV = CVV + 5
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN AVV = AVV + 4
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN AVV = AVV + 4
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN AVV = AVV + 4
IF MOVTYPN = "O" AND PTEMPVALN = "XXOXEXOOE" THEN EVV = EVV + 13
IF MOVTYPN = "X" AND PTEMPVALN = "OOXOEOXXE" THEN EVV = EVV + 13
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEXOOE" THEN EVV = EVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEOXXE" THEN EVV = EVV + 12
IF MOVTYPN = "X" AND PTEMPVALN = "XXOEEXOOE" THEN EVV = EVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "OOXEEOXXE" THEN EVV = EVV + 11
IF MOVTYPN = "O" AND PTEMPVALN = "XXOEEXEOE" THEN GVV = GVV + 10
IF MOVTYPN = "X" AND PTEMPVALN = "OOXEEOEXE" THEN GVV = GVV + 10
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEEXEOE" THEN GVV = GVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEEOEXE" THEN GVV = GVV + 9
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEEXEOE" THEN GVV = GVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEEOEXE" THEN GVV = GVV + 8
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEEXEEE" THEN HVV = HVV + 7
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEEOEEE" THEN HVV = HVV + 7
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEEXEEE" THEN HVV = HVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEEOEEE" THEN HVV = HVV + 6
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEEXEEE" THEN HVV = HVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEEOEEE" THEN HVV = HVV + 5
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEXEEE" THEN CVV = CVV + 4
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEOEEE" THEN CVV = CVV + 4
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEEEEEE" THEN BVV = BVV + 6
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEEEEEE" THEN BVV = BVV + 5
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEEEEEE" THEN BVV = BVV + 5
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN AVV = AVV + 4
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN AVV = AVV + 4

END SUB


Walter Whitman
The Joyful Programmer
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#4
Anthony,

I tried your computer-vs-computer data and I was able to easily beat the computer. Try put the code I posted above.


Walter Whitman
The Joyful Programmer
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#5
(06-28-2014, 06:41 AM)waltersmind Wrote: Anthony,

I tried your computer-vs-computer data and I was able to easily beat the computer. Try put the code I posted above.


Walter Whitman
The Joyful Programmer

Walter

The Game DATA I posted was as I said just the first Stage of the Computer learning on it's own!
It needed a lot more than (7) Games to be any Good!
Plus because Computers are dumb at first...they don't understand anything about playing in the Centre first!
The fascinating thing for me is to see if the Computer playing it'self using the famous Computer A,B,C, A.I Method Smile can get any better ? and it does as I showed.
The Quickest way to get the Program to play Strong Quickly...is for a Human to play against it! then it learns all the Correct Strategy! which is how I imagine you taught it above....Great stuff!


Anthony. 
Reply
#6
Anthony,

Yes, the data was all from Player Vs Computer, and I always let the computer go first. I probably should start the games off myself to give the computer more things to think about.


Walter Whitman
The Joyful Programmer
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#7
(06-28-2014, 10:36 PM)waltersmind Wrote: Anthony,

Yes, the data was all from Player Vs Computer, and I always let the computer go first. I probably should start the games off myself to give the computer more things to think about.


Walter Whitman
The Joyful Programmer

That's what I thought!...there is a Quick way to make the Program and others like it! much Stronger! by using some Human Knowledge (which is a bit of cheating!) Smile by changing the order of the Squares the Program looks at first...instead of (A,B,C,D,E,F,G,H,I,) to (E,4 ways to win) then (A,C,G,I all have 3 ways to win) and then last (B,D,F,H all have 2 ways to win) 
Amazing what one can do even with such a simple Game! 

Anthony.
Reply
#8
Anthony,

Even though something like Tic-Tac-Toe seems fairly simple to us humans, when we try to define the logic that's in our brains, it quickly becomes much more complex than one realizes. Our brain uses visual cues to help us analyze a problem, but porting that information over to a inferior and limited machine can become a challenge. We have to encode each visual cue into some form that we and the computer can understand, and then try to optimize the language conversion as much as we can.

For example, we could do what our brain does and have the computer analyze the image to see if it is a X or O. That in its self is a complex task for the programmer and computer. We can optimize it down to defining a array of bytes where a 0=Empty, 1=X, 2=O, which would help speed up the analyzing and test phase. we could even go further with the optimizing and store those three values into 2-Bits each, and store the entire board in an unsigned long variable. We could then easily compare that unsigned long variable with other variables of the same kind that holds various patterns, similar to what you save into the data file. Instead of "XOEEXEXEE" you would have a value of 148,000 (dec), &h00024220 (hex), or &b00000000000000100100001000100000 (bin). With the binary way, all we had to do was compare the value with a winning, or better placement value, and presto. If you study the binary way, you might even begin to see patterns in the data that will allow you to optimize the logic and/or code for faster checking.

As I tell everyone, there are many ways of doing the same thing in computer programming, some ways are just more efficient than others.

Walter Whitman
The Joyful Programmer
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#9
OK! Walter this is the BIG! One Smile

Now you have had a look at & Played OXAUTOLN2

And I imagine a look at the code...I would Now! like to make the Ultimate version of the Program Version OXAUTOLN3 Cool

It's something I have wanted to do for a long time...but was Never sure how or if it's possible to do it ?
Making this Program the Dream Version 3 will also help me with My QBASIC CHESS 2014


So calling on all your Expertise ? Smile...do you think it would be possible to make the Program have (Fully Auto Learning in Real time) ?

What I mean is instead of having to Stop the Program after every game and Copy & Paste the Learning DATA into the SUB LEARNDATA1 and Save... then delete the O&XDATA.TXT ready for the Next game...with the Learning preserved!...PHEW!...
Would it be possible to do all the above without Stopping the Program ?
Then you could Start the Program on Auto Play Computer v Computer and sit back to watch it Master the Game in Real time! 
I Imagine there would have to be some way of Sending/Saving the Learning DATA into an external file and then Automatically reading it back into the Program in Real time! I have No! idea how to do it Sad
And as a Bonus for this Amazing Version of the Program to improve the Graphics... with a large Board & Pieces shown in the middle of the Screen!

Attached & below is the Start of Version 3 Now! with Optimised Start A.I to make the Program learn Quicker!

P.S If the above is possible ? there would need to be some way of making the Program STOP! after so many DRAWS! playing itself otherwise it would play Infinitely...a Cut off point based on so many DRAWS! maybe... and  the Question is how do we tell it or know when it has Mastered the Game ?

Code:
DECLARE SUB LEARNDATA1 ()

DIM SHARED LASTDRAWN AS STRING
DIM SHARED COMP01RVAL AS INTEGER
DIM SHARED COMP02RVAL AS INTEGER
DIM SHARED GAMETYP AS INTEGER
DIM SHARED WHOMFST AS STRING
DIM SHARED MOVTYPN AS STRING
DIM SHARED MOVTYPR AS STRING
DIM SHARED MOVMADE AS STRING
DIM SHARED HUMANMOVED AS INTEGER
DIM SHARED COMP01MOVED AS INTEGER
DIM SHARED COMP02MOVED AS INTEGER
DIM SHARED COMPMAXVAL AS LONG
DIM SHARED AVV AS INTEGER
DIM SHARED BVV AS INTEGER
DIM SHARED CVV AS INTEGER
DIM SHARED DVV AS INTEGER
DIM SHARED EVV AS INTEGER
DIM SHARED FVV AS INTEGER
DIM SHARED GVV AS INTEGER
DIM SHARED HVV AS INTEGER
DIM SHARED IVV AS INTEGER
DIM SHARED P001 AS STRING
DIM SHARED P002 AS STRING
DIM SHARED P003 AS STRING
DIM SHARED P004 AS STRING
DIM SHARED P005 AS STRING
DIM SHARED P006 AS STRING
DIM SHARED P007 AS STRING
DIM SHARED P008 AS STRING
DIM SHARED P009 AS STRING
DIM SHARED P001VN AS STRING
DIM SHARED P002VN AS STRING
DIM SHARED P003VN AS STRING
DIM SHARED P004VN AS STRING
DIM SHARED P005VN AS STRING
DIM SHARED P006VN AS STRING
DIM SHARED P007VN AS STRING
DIM SHARED P008VN AS STRING
DIM SHARED P009VN AS STRING
DIM SHARED P001VR AS STRING
DIM SHARED P002VR AS STRING
DIM SHARED P003VR AS STRING
DIM SHARED P004VR AS STRING
DIM SHARED P005VR AS STRING
DIM SHARED P006VR AS STRING
DIM SHARED P007VR AS STRING
DIM SHARED P008VR AS STRING
DIM SHARED P009VR AS STRING
DIM SHARED PTEMPVALN AS STRING
DIM SHARED PTEMPVALR AS STRING
DIM SHARED MOVTYP000N AS STRING
DIM SHARED MOVTYP001N AS STRING
DIM SHARED MOVTYP002N AS STRING
DIM SHARED MOVTYP003N AS STRING
DIM SHARED MOVTYP004N AS STRING
DIM SHARED MOVTYP005N AS STRING
DIM SHARED MOVTYP006N AS STRING
DIM SHARED MOVTYP007N AS STRING
DIM SHARED MOVTYP008N AS STRING
DIM SHARED MOVTYP009N AS STRING
DIM SHARED MOVTYP000R AS STRING
DIM SHARED MOVTYP001R AS STRING
DIM SHARED MOVTYP002R AS STRING
DIM SHARED MOVTYP003R AS STRING
DIM SHARED MOVTYP004R AS STRING
DIM SHARED MOVTYP005R AS STRING
DIM SHARED MOVTYP006R AS STRING
DIM SHARED MOVTYP007R AS STRING
DIM SHARED MOVTYP008R AS STRING
DIM SHARED MOVTYP009R AS STRING
DIM SHARED MOVREG000N AS STRING
DIM SHARED MOVREG001N AS STRING
DIM SHARED MOVREG002N AS STRING
DIM SHARED MOVREG003N AS STRING
DIM SHARED MOVREG004N AS STRING
DIM SHARED MOVREG005N AS STRING
DIM SHARED MOVREG006N AS STRING
DIM SHARED MOVREG007N AS STRING
DIM SHARED MOVREG008N AS STRING
DIM SHARED MOVREG009N AS STRING
DIM SHARED MOVREG000R AS STRING
DIM SHARED MOVREG001R AS STRING
DIM SHARED MOVREG002R AS STRING
DIM SHARED MOVREG003R AS STRING
DIM SHARED MOVREG004R AS STRING
DIM SHARED MOVREG005R AS STRING
DIM SHARED MOVREG006R AS STRING
DIM SHARED MOVREG007R AS STRING
DIM SHARED MOVREG008R AS STRING
DIM SHARED MOVREG009R AS STRING
DIM SHARED MOVSCOUNT AS INTEGER
DIM SHARED MOVSCTDWN AS INTEGER
DIM SHARED WLINE001 AS STRING
DIM SHARED WLINE002 AS STRING
DIM SHARED WLINE003 AS STRING
DIM SHARED WLINE004 AS STRING
DIM SHARED WLINE005 AS STRING
DIM SHARED WLINE006 AS STRING
DIM SHARED WLINE007 AS STRING
DIM SHARED WLINE008 AS STRING
DIM SHARED GMOVERO AS INTEGER
DIM SHARED GMOVERX AS INTEGER
DIM SHARED GMOVERD AS INTEGER
DIM SHARED DRAWNSAVEDONE AS INTEGER
SCREEN 11
REM-----------------------------------------------------------------------------------------------------------
CLS
PRINT : PRINT
PRINT TAB(11); "OXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXO"
PRINT : PRINT
PRINT TAB(90); "         { OXAUTOLN3 } O&X AUTO SELF LEARNING PROGRAM!  "
PRINT : PRINT
PRINT TAB(90); "       ORIGINAL-V1.23/02/2002 THIS VERSION-V3.30/06/2014 "
PRINT : PRINT
PRINT TAB(90); "             NOTICE! THIS VERSION NOT! COMPLETED ? "
PRINT : PRINT
PRINT TAB(90); "                NOW! WITH OPTIMISED START A.I. :) "
PRINT : PRINT
PRINT TAB(90); "              PLUS BETTER GRAPHICS BOARD & PIECES "
PRINT : PRINT
PRINT TAB(90); "       LEARNING NOW! AUTO SAVED & LEARNT IN O&XDATA.TXT ? "
PRINT : PRINT
PRINT TAB(90); "                 BY, [A][R][B] COMPUTER SOFTWARE. "
PRINT : PRINT
PRINT TAB(11); "OXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXO"
PRINT : PRINT
INPUT " PRESS (ENTER) TO START PROGRAM! "; XYZ$
LASTDRAWNINPUT:
CLS
PRINT : PRINT
INPUT " WAS THE LAST GAME A DRAWN GAME! ENTER (Y) OR (N) "; LASTDRAWN
IF LASTDRAWN = "y" THEN LASTDRAWN = "Y"
IF LASTDRAWN = "n" THEN LASTDRAWN = "N"
IF LASTDRAWN = "Y" THEN GOTO START
IF LASTDRAWN = "N" THEN GOTO START
GOTO LASTDRAWNINPUT
REM-----------------------------------------------------------------------------------------------------------
START:
CLS
REM BELOW GIVE MAIN BOARD REGISTER START VARIABLES! A STRING EMPTY SQUARE VALUE!
P001VN = "E": P002VN = "E": P003VN = "E"
P004VN = "E": P005VN = "E": P006VN = "E"
P007VN = "E": P008VN = "E": P009VN = "E"
PTEMPVALN = P001VN + P002VN + P003VN + P004VN + P005VN + P006VN + P007VN + P008VN + P009VN
REM BELOW REVERSE LEARNING BOARD REGISTER START VARIABLES!
P001VR = "E": P002VR = "E": P003VR = "E"
P004VR = "E": P005VR = "E": P006VR = "E"
P007VR = "E": P008VR = "E": P009VR = "E"
PTEMPVALR = P001VR + P002VR + P003VR + P004VR + P005VR + P006VR + P007VR + P008VR + P009VR
PRINT : PRINT
INPUT " ENTER GAME TYPE!  HUMAN V COMPUTER = 1  COMPUTER V COMPUTER = 2  "; GAMETYP
IF GAMETYP = 1 THEN GOTO WHOMOVESFIRST
IF GAMETYP = 2 THEN GOTO COMPRANDOMSTART
GOTO START
REM-----------------------------------------------------------------------------------------------------------
WHOMOVESFIRST:
CLS
PRINT : PRINT
INPUT " ENTER WHO MOVES FIRST!  HUMAN = (O)  COMPUTER = (X)  "; WHOMFST
IF WHOMFST = "o" THEN WHOMFST = "O"
IF WHOMFST = "x" THEN WHOMFST = "X"
IF WHOMFST = "O" THEN MOVTYPN = ""
IF WHOMFST = "O" THEN GOSUB BOARD
IF WHOMFST = "O" THEN GOTO HUMAN
IF WHOMFST = "X" THEN MOVTYPN = ""
IF WHOMFST = "X" THEN GOSUB BOARD
IF WHOMFST = "X" THEN GOTO COMPUTER01
GOTO WHOMOVESFIRST
REM-----------------------------------------------------------------------------------------------------------
COMPRANDOMSTART:
RANDOMIZE TIMER
COMPRAND12 = INT(RND * 100) + 1
IF COMPRAND12 < 50 THEN MOVTYPN = ""
IF COMPRAND12 < 50 THEN GOSUB BOARD
IF COMPRAND12 < 50 THEN GOTO COMPUTER01
IF COMPRAND12 > 50 THEN MOVTYPN = ""
IF COMPRAND12 > 50 THEN GOSUB BOARD
IF COMPRAND12 > 50 THEN GOTO COMPUTER02
GOTO COMPRANDOMSTART
REM-----------------------------------------------------------------------------------------------------------
BOARD:
CLS
REM BELOW PRINT ALL MOVES MADE ONTO THE BOARD!
IF MOVMADE = "A" AND P001 = "" THEN P001 = MOVTYPN
IF MOVMADE = "B" AND P002 = "" THEN P002 = MOVTYPN
IF MOVMADE = "C" AND P003 = "" THEN P003 = MOVTYPN
IF MOVMADE = "D" AND P004 = "" THEN P004 = MOVTYPN
IF MOVMADE = "E" AND P005 = "" THEN P005 = MOVTYPN
IF MOVMADE = "F" AND P006 = "" THEN P006 = MOVTYPN
IF MOVMADE = "G" AND P007 = "" THEN P007 = MOVTYPN
IF MOVMADE = "H" AND P008 = "" THEN P008 = MOVTYPN
IF MOVMADE = "I" AND P009 = "" THEN P009 = MOVTYPN
PRINT : PRINT : PRINT : PRINT
PRINT TAB(20); "(A)= "; P001; TAB(40); "(B)= "; P002; TAB(60); "(C)= "; P003
PRINT : PRINT : PRINT : PRINT : PRINT
PRINT TAB(20); "(D)= "; P004; TAB(40); "(E)= "; P005; TAB(60); "(F)= "; P006
PRINT : PRINT : PRINT : PRINT : PRINT
PRINT TAB(20); "(G)= "; P007; TAB(40); "(H)= "; P008; TAB(60); "(I)= "; P009
PRINT : PRINT : PRINT : PRINT
IF MOVTYPN = "" THEN RETURN: REM BACK TO HUMAN (NO INPUT) OR COMPUTERS AT RANDOM START!
REM BELOW MAIN BOARD POSITION! MOVE REGISTER VARIABLES!
IF P001 <> "" AND P001VN = "E" THEN P001VN = MOVTYPN
IF P002 <> "" AND P002VN = "E" THEN P002VN = MOVTYPN
IF P003 <> "" AND P003VN = "E" THEN P003VN = MOVTYPN
IF P004 <> "" AND P004VN = "E" THEN P004VN = MOVTYPN
IF P005 <> "" AND P005VN = "E" THEN P005VN = MOVTYPN
IF P006 <> "" AND P006VN = "E" THEN P006VN = MOVTYPN
IF P007 <> "" AND P007VN = "E" THEN P007VN = MOVTYPN
IF P008 <> "" AND P008VN = "E" THEN P008VN = MOVTYPN
IF P009 <> "" AND P009VN = "E" THEN P009VN = MOVTYPN
REM BELOW MAIN BOARD POSITION! MOVE REGISTER REVERSE VARIABLES!
REM BELOW SET TYPE(R) VARIABLES FOR REVERSE MOVES LEARNING!
IF MOVTYPN = "O" THEN MOVTYPR = "X"
IF MOVTYPN = "X" THEN MOVTYPR = "O"
IF P001 <> "" AND P001VR = "E" THEN P001VR = MOVTYPR
IF P002 <> "" AND P002VR = "E" THEN P002VR = MOVTYPR
IF P003 <> "" AND P003VR = "E" THEN P003VR = MOVTYPR
IF P004 <> "" AND P004VR = "E" THEN P004VR = MOVTYPR
IF P005 <> "" AND P005VR = "E" THEN P005VR = MOVTYPR
IF P006 <> "" AND P006VR = "E" THEN P006VR = MOVTYPR
IF P007 <> "" AND P007VR = "E" THEN P007VR = MOVTYPR
IF P008 <> "" AND P008VR = "E" THEN P008VR = MOVTYPR
IF P009 <> "" AND P009VR = "E" THEN P009VR = MOVTYPR
REM-----------------------------------------------------------------------------------------------------------
REM BELOW MAIN BOARD POSITIONS! NORMAL AND REVERSE LEARNING REGISTER VARIABLES!
PTEMPVALN = P001VN + P002VN + P003VN + P004VN + P005VN + P006VN + P007VN + P008VN + P009VN
PTEMPVALR = P001VR + P002VR + P003VR + P004VR + P005VR + P006VR + P007VR + P008VR + P009VR
MOVREGISTER000: REM BELOW MOVE (0) NORMAL AND REVERSE MOVE REGISTERS!
REM NOTICE!! THIS IS THE FIRST BEST MOVE EMPTY BOARD REGISTER! SO DIFFERENT!
IF MOVREG000N <> "" THEN GOTO MOVREGISTER001
MOVREG000N = "EEEEEEEEE": MOVTYP000N = MOVMADE
MOVREG000R = "EEEEEEEEE": MOVTYP000R = MOVMADE
REM NOTICE!! NO IMMEDIATE BRANCH TO (WINCHECKS) AS BOTH FIRST (2) REGISTERS DONE AT SAME TIME!
MOVREGISTER001: REM BELOW MOVE (1) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG001N <> "" THEN GOTO MOVREGISTER002
MOVSCOUNT = MOVSCOUNT + 1
MOVREG001N = PTEMPVALN: MOVTYP001N = MOVMADE
MOVREG001R = PTEMPVALR: MOVTYP001R = MOVMADE
GOTO WINCHECKS
MOVREGISTER002: REM BELOW MOVE (2) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG002N <> "" THEN GOTO MOVREGISTER003
MOVSCOUNT = MOVSCOUNT + 1
MOVREG002N = PTEMPVALN: MOVTYP002N = MOVMADE
MOVREG002R = PTEMPVALR: MOVTYP002R = MOVMADE
GOTO WINCHECKS
MOVREGISTER003: REM BELOW MOVE (3) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG003N <> "" THEN GOTO MOVREGISTER004
MOVSCOUNT = MOVSCOUNT + 1
MOVREG003N = PTEMPVALN: MOVTYP003N = MOVMADE
MOVREG003R = PTEMPVALR: MOVTYP003R = MOVMADE
GOTO WINCHECKS
MOVREGISTER004: REM BELOW MOVE (4) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG004N <> "" THEN GOTO MOVREGISTER005
MOVSCOUNT = MOVSCOUNT + 1
MOVREG004N = PTEMPVALN: MOVTYP004N = MOVMADE
MOVREG004R = PTEMPVALR: MOVTYP004R = MOVMADE
GOTO WINCHECKS
MOVREGISTER005: REM BELOW MOVE (5) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG005N <> "" THEN GOTO MOVREGISTER006
MOVSCOUNT = MOVSCOUNT + 1
MOVREG005N = PTEMPVALN: MOVTYP005N = MOVMADE
MOVREG005R = PTEMPVALR: MOVTYP005R = MOVMADE
GOTO WINCHECKS
MOVREGISTER006: REM BELOW MOVE (6) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG006N <> "" THEN GOTO MOVREGISTER007
MOVSCOUNT = MOVSCOUNT + 1
MOVREG006N = PTEMPVALN: MOVTYP006N = MOVMADE
MOVREG006R = PTEMPVALR: MOVTYP006R = MOVMADE
GOTO WINCHECKS
MOVREGISTER007: REM BELOW MOVE (7) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG007N <> "" THEN GOTO MOVREGISTER008
MOVSCOUNT = MOVSCOUNT + 1
MOVREG007N = PTEMPVALN: MOVTYP007N = MOVMADE
MOVREG007R = PTEMPVALR: MOVTYP007R = MOVMADE
GOTO WINCHECKS
MOVREGISTER008: REM BELOW MOVE (8) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG008N <> "" THEN GOTO MOVREGISTER009
MOVSCOUNT = MOVSCOUNT + 1
MOVREG008N = PTEMPVALN: MOVTYP008N = MOVMADE
MOVREG008R = PTEMPVALR: MOVTYP008R = MOVMADE
GOTO WINCHECKS
MOVREGISTER009: REM BELOW MOVE (9) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG009N <> "" THEN GOTO WINCHECKS
MOVSCOUNT = MOVSCOUNT + 1
MOVREG009N = PTEMPVALN: MOVTYP009N = MOVMADE
MOVREG009R = PTEMPVALR: MOVTYP009R = MOVMADE
REM-----------------------------------------------------------------------------------------------------------
WINCHECKS: REM BELOW CHECK IF ANY OF THE (8) WINNING LINES HAVE BEEN MADE!
WLINE001 = P001 + P002 + P003
WLINE002 = P004 + P005 + P006
WLINE003 = P007 + P008 + P009
WLINE004 = P001 + P004 + P007
WLINE005 = P002 + P005 + P008
WLINE006 = P003 + P006 + P009
WLINE007 = P001 + P005 + P009
WLINE008 = P003 + P005 + P007
IF WLINE001 = "OOO" THEN GMOVERO = 1
IF WLINE002 = "OOO" THEN GMOVERO = 1
IF WLINE003 = "OOO" THEN GMOVERO = 1
IF WLINE004 = "OOO" THEN GMOVERO = 1
IF WLINE005 = "OOO" THEN GMOVERO = 1
IF WLINE006 = "OOO" THEN GMOVERO = 1
IF WLINE007 = "OOO" THEN GMOVERO = 1
IF WLINE008 = "OOO" THEN GMOVERO = 1
IF WLINE001 = "XXX" THEN GMOVERX = 1
IF WLINE002 = "XXX" THEN GMOVERX = 1
IF WLINE003 = "XXX" THEN GMOVERX = 1
IF WLINE004 = "XXX" THEN GMOVERX = 1
IF WLINE005 = "XXX" THEN GMOVERX = 1
IF WLINE006 = "XXX" THEN GMOVERX = 1
IF WLINE007 = "XXX" THEN GMOVERX = 1
IF WLINE008 = "XXX" THEN GMOVERX = 1
REM BELOW CHECK IF ALL MOVES HAVE BEEN MADE!
IF MOVSCOUNT >= 9 THEN GMOVERD = 1
REM BELOW REGISTER WHO HAS JUST MADE A MOVE!
IF GAMETYP = 1 AND MOVTYPN = "O" THEN HUMANMOVED = 1
IF GAMETYP = 1 AND MOVTYPN = "X" THEN COMP01MOVED = 1
IF GAMETYP = 2 AND MOVTYPN = "X" THEN COMP01MOVED = 1
IF GAMETYP = 2 AND MOVTYPN = "O" THEN COMP02MOVED = 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
HUMAN:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
HUMANMOVED = 0
HUMANINPUT:
MOVMADE = ""
MOVTYPN = "O"
INPUT " HUMANS MOVE! ENTER THE LETTER (A - I) FOR YOUR MOVE!  "; MOVMADE
IF MOVMADE = "a" THEN MOVMADE = "A"
IF MOVMADE = "b" THEN MOVMADE = "B"
IF MOVMADE = "c" THEN MOVMADE = "C"
IF MOVMADE = "d" THEN MOVMADE = "D"
IF MOVMADE = "e" THEN MOVMADE = "E"
IF MOVMADE = "f" THEN MOVMADE = "F"
IF MOVMADE = "g" THEN MOVMADE = "G"
IF MOVMADE = "h" THEN MOVMADE = "H"
IF MOVMADE = "i" THEN MOVMADE = "I"
IF MOVMADE = "A" AND P001 = "" THEN GOSUB BOARD
IF MOVMADE = "B" AND P002 = "" THEN GOSUB BOARD
IF MOVMADE = "C" AND P003 = "" THEN GOSUB BOARD
IF MOVMADE = "D" AND P004 = "" THEN GOSUB BOARD
IF MOVMADE = "E" AND P005 = "" THEN GOSUB BOARD
IF MOVMADE = "F" AND P006 = "" THEN GOSUB BOARD
IF MOVMADE = "G" AND P007 = "" THEN GOSUB BOARD
IF MOVMADE = "H" AND P008 = "" THEN GOSUB BOARD
IF MOVMADE = "I" AND P009 = "" THEN GOSUB BOARD
IF GAMETYP = 1 AND HUMANMOVED = 1 THEN GOTO COMPUTER01
MOVTYPN = "": REM MAKES RETURN FROM BOARD WORK! AS NO MOVE INPUT MADE!
GOSUB BOARD
GOTO HUMANINPUT
REM-----------------------------------------------------------------------------------------------------------
COMPUTER01:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
COMP01MOVED = 0
MOVMADE = ""
MOVTYPN = "X"
PRINT " COMPUTER01 THINKING!........................................................."
CALL LEARNDATA1: REM CALL MAIN LEARNING DATA SUBS FOR BEST MOVE VALUES!
COMPMAXVAL = 1000000
IF LASTDRAWN = "Y" THEN GOTO COMP01RNDSTART
COMPUTER01INPUT:
REM BELOW NOW! OPTIMISED :)
IF EVV >= COMPMAXVAL AND P005 = "" THEN MOVMADE = "E"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF AVV >= COMPMAXVAL AND P001 = "" THEN MOVMADE = "A"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF IVV >= COMPMAXVAL AND P009 = "" THEN MOVMADE = "I"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF CVV >= COMPMAXVAL AND P003 = "" THEN MOVMADE = "C"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF GVV >= COMPMAXVAL AND P007 = "" THEN MOVMADE = "G"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF BVV >= COMPMAXVAL AND P002 = "" THEN MOVMADE = "B"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF HVV >= COMPMAXVAL AND P008 = "" THEN MOVMADE = "H"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF DVV >= COMPMAXVAL AND P004 = "" THEN MOVMADE = "D"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF FVV >= COMPMAXVAL AND P006 = "" THEN MOVMADE = "F"
COMPMAKEMOVE01:
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 1 AND COMP01MOVED = 1 THEN GOTO HUMAN
IF GAMETYP = 2 AND COMP01MOVED = 1 THEN GOTO COMPUTER02
COMPMAXVAL = COMPMAXVAL - 1
GOTO COMPUTER01INPUT
COMP01RNDSTART:
LASTDRAWN = "": REM LAST DRAWN GAME FIRST MOVE! NOW MADE!
RANDOMIZE TIMER
COMP01RVAL = INT(RND * 10) + 1
REM BELOW NOW! OPTIMISED :)
IF COMP01RVAL = 5 AND P005 = "" THEN MOVMADE = "E"
IF COMP01RVAL = 1 AND P001 = "" THEN MOVMADE = "A"
IF COMP01RVAL = 9 AND P009 = "" THEN MOVMADE = "I"
IF COMP01RVAL = 3 AND P003 = "" THEN MOVMADE = "C"
IF COMP01RVAL = 7 AND P007 = "" THEN MOVMADE = "G"
IF COMP01RVAL = 2 AND P002 = "" THEN MOVMADE = "B"
IF COMP01RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP01RVAL = 4 AND P004 = "" THEN MOVMADE = "D"
IF COMP01RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP01RVAL = 6 AND P006 = "" THEN MOVMADE = "F"
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 1 AND COMP01MOVED = 1 THEN GOTO HUMAN
IF GAMETYP = 2 AND COMP01MOVED = 1 THEN GOTO COMPUTER02
GOTO COMP01RNDSTART
REM-----------------------------------------------------------------------------------------------------------
COMPUTER02:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
COMP02MOVED = 0
MOVMADE = ""
MOVTYPN = "O"
PRINT " COMPUTER02 THINKING!........................................................."
CALL LEARNDATA1: REM CALL MAIN LEARNING DATA SUBS FOR BEST MOVE VALUES!
COMPMAXVAL = 1000000
IF LASTDRAWN = "Y" THEN GOTO COMP02RNDSTART
COMPUTER02INPUT:
REM BELOW NOW! OPTIMISED :)
IF EVV >= COMPMAXVAL AND P005 = "" THEN MOVMADE = "E"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF AVV >= COMPMAXVAL AND P001 = "" THEN MOVMADE = "A"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF IVV >= COMPMAXVAL AND P009 = "" THEN MOVMADE = "I"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF CVV >= COMPMAXVAL AND P003 = "" THEN MOVMADE = "C"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF GVV >= COMPMAXVAL AND P007 = "" THEN MOVMADE = "G"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF BVV >= COMPMAXVAL AND P002 = "" THEN MOVMADE = "B"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF HVV >= COMPMAXVAL AND P008 = "" THEN MOVMADE = "H"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF DVV >= COMPMAXVAL AND P004 = "" THEN MOVMADE = "D"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF FVV >= COMPMAXVAL AND P006 = "" THEN MOVMADE = "F"
COMPMAKEMOVE02:
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 2 AND COMP02MOVED = 1 THEN GOTO COMPUTER01
COMPMAXVAL = COMPMAXVAL - 1
GOTO COMPUTER02INPUT
COMP02RNDSTART:
LASTDRAWN = "": REM LAST DRAWN GAME FIRST MOVE! NOW MADE!
RANDOMIZE TIMER
COMP02RVAL = INT(RND * 10) + 1
REM BELOW NOW! OPTIMISED :)
IF COMP02RVAL = 5 AND P005 = "" THEN MOVMADE = "E"
IF COMP02RVAL = 1 AND P001 = "" THEN MOVMADE = "A"
IF COMP02RVAL = 9 AND P009 = "" THEN MOVMADE = "I"
IF COMP02RVAL = 3 AND P003 = "" THEN MOVMADE = "C"
IF COMP02RVAL = 7 AND P007 = "" THEN MOVMADE = "G"
IF COMP02RVAL = 2 AND P002 = "" THEN MOVMADE = "B"
IF COMP02RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP02RVAL = 4 AND P004 = "" THEN MOVMADE = "D"
IF COMP02RVAL = 6 AND P006 = "" THEN MOVMADE = "F"
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 2 AND COMP02MOVED = 1 THEN GOTO COMPUTER01
GOTO COMP02RNDSTART
REM-----------------------------------------------------------------------------------------------------------
GAMENDLEARN:
MOVSCTDWN = 13: REM MAX SCORE VALUE COUNT DOWN VARIABLE!
OXDATA$ = "O&XDATA.TXT"
OPEN OXDATA$ FOR APPEND AS #1: REM NOW LEARNT DATA SAVED!
REM BELOW (9) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN9
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN7
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 9 THEN GOTO MOVSLEARNEND
REM BELOW (8) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN8
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN6
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN4
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN2
IF MOVSCOUNT = 8 THEN GOTO MOVSLEARNEND
REM BELOW (7) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN7
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 7 THEN GOTO MOVSLEARNEND
REM BELOW (6) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN6
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN4
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN2
IF MOVSCOUNT = 6 THEN GOTO MOVSLEARNEND
REM BELOW (5) MOVES GAME PLAYED LEARNING BRANCHES!
REM NOTICE! QUICKEST WIN! POSSIBLE!
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 5 THEN GOTO MOVSLEARNEND
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN9: REM BELOW LEARN BLOCK (9) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN8: REM BELOW LEARN BLOCK (8) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN7: REM BELOW LEARN BLOCK (7) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN6: REM BELOW LEARN BLOCK (6) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN5: REM BELOW LEARN BLOCK (5) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN4: REM BELOW LEARN BLOCK (4) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN3: REM BELOW LEARN BLOCK (3) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN2: REM BELOW LEARN BLOCK (2) (2nd PLAYERS FIRST MOVE)!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP002N; "VV = "; MOVTYP002N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP002R; "VV = "; MOVTYP002R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN1: REM BELOW LEARN BLOCK (1) (1st PLAYERS FIRST MOVE)! EMPTY BOARD!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG000N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP000N; "VV = "; MOVTYP000N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG000R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP000R; "VV = "; MOVTYP000R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
MOVSLEARNEND:
CLOSE
REM-----------------------------------------------------------------------------------------------------------
RESTART:
IF GMOVERO = 1 THEN GOTO WINPRINTOUT
IF GMOVERX = 1 THEN GOTO WINPRINTOUT
PRINT "    ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW!"
GOTO NEWGAMEINPUT
WINPRINTOUT:
IF GMOVERO = 1 THEN PRINT "(O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS!"
IF GMOVERX = 1 THEN PRINT "(X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS!"
NEWGAMEINPUT:
PRINT
INPUT " PRESS (ENTER) FOR ANOTHER GAME! OR (QU) TO QUIT! "; QUIT$
IF QUIT$ = "QU" THEN END
IF QUIT$ = "qu" THEN END
RUN
GOTO NEWGAMEINPUT

SUB LEARNDATA1


END SUB



Anthony.
Reply
#10
Anthony,

That is a sweet yes! We can make you Dream Version #3.

First, we have the program check for the existence of a binary data file that stores all of the programs learning data. If one is not there, then create it. Otherwise open it as binary and read the data into a _MEM. We would need to check the file size and make the _MEM a certain size bigger to allow for any new data the game collects during its run. At certain points (possibly at the end of every played game) save the used part of the _MEM back into the binary data file.

Actually, it is more involved than that, but that is the jest of it.

I will create the graphics for Dream Version #3, so you don't need to worry about that.

As far as the program mastering Tic-Tac-Toe, that is a good question. I will first have to study your code and AI to understand how it thinks. Then I should be able to come up with answer to that. I believe it is much more simpler than you might expect.

Here are some really good links:

http://en.wikipedia.org/wiki/Tic-tac-toe


http://www.jesperjuul.net/ludologist/255...ic-tac-toe


https://answers.yahoo.com/question/index...527AAKngqi

From Berkeley University in California (USA): http://www.cs.berkeley.edu/~bh/pdf/v1ch06.pdf

http://www.wikihow.com/Win-at-Tic-Tac-Toe

One thing I noticed on these sites, if you don't take symmetries (rotations and mirrors [reflection] of a board that are exact copies of other games) of the board into account, there are 255,168 unique games of Tic-Tac-Toe. The WikiPedia site states in 2002, a gentleman by the name of Steve Schaeffer discovered (through a computer program) that if you took symmetries into account, there are a total of 26,830 unique games. If we stored all 255,168 games as _UNSIGNED LONG variables (4 Bytes per variable), you would only take up close to 1MB of memory space. If you take symmetries into account, you can compress the maximum data memory usage down to 105K for all possible games.

To create the data all the possible games, you can write a program to create the data by using the brute force method. You can then start compressing the data by checking each game data with the other games, along with its mirrors and rotations, and deleting any matches.

A secret I always told everyone when it comes to just about anything, is break everything down into its smallest components.


Walter Whitman
The Joyful Programmer
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#11
Fantastic Walter...

I don't have a Problem making a Nought's & Crosses / Tic-Tac-Toe Program that plays Perfect! if I just put in all the Winning lines...as a Fixed way of it finding the Best move.
But as I said before...that is kind of Cheating...and Knowing that we can do it for such a small game Tree is Not! what this is about it's about getting the Program to do it on it's own Smile then we can move on to Solving more Complex problems where we know because of the size of the Game Tree Etc. it would be too much Code/Work and time involved in trying to make such a Program!
So without going along the (Kind of Cheating way!) can we do it in same kind of way as My Program!
All I have done with this Version 3 is changed the Squares it looks at first according to the amount of Winning lines...which is as I said is just a way to speed things up...I don't think it's too much of a Cheat.
If we were taking on a much more difficult Problem...then we would need all the Tricks possible especially when up against other Programmers as in a Game A.I Computer Championship!

I calmly wait like a Person that has Not! drank or ate for months! Smile


Anthony.
Reply
#12
Anthony,

I think I understand now. What you are looking for is a way for the game to learn on its own, instead of giving it instant knowledge of all possible moves. You are wanting to build a "learning system" that could learn on it's own. A true artificially intelligent brain sort-of-speak.

This will be interesting to say the least.

Well, if we put our brains together, we should come up with something.

Could you explain how your current learning system works? What information does it "remember"? What do you check for?

What I saw when I ran your demo was amazing, and how you could add data to make it smarter.

You know, now that I am thinking about it, if we make this artificially intelligent learning system work for Tic-Tac-Toe, we can make it work for bigger games like, Black Jack 21, Connect 4, Chess, Poker, Rummy, or even Go Fish! The possibilities are endless.


Thanks,
Walter Whitman
The Joyful Programmer
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#13
(07-02-2014, 12:38 AM) waltersmind Wrote: Anthony,

I think I understand now. What you are looking for is a way for the game to learn on its own, instead of giving it instant knowledge of all possible moves. You are wanting to build a "learning system" that could learn on it's own. A true artificially intelligent brain sort-of-speak.
 
Reply: Anthony

Yes! Walter that's Exactly what My Program does! that's why the Original program can Start as Dumb as possible...by first looking at the Squares A,B,C Onwards! and then it learns and learns by building up a Permanent Score for each Square! But more important the Order of Squares in a Linked way! that's why if you take a look at the Code the Quickest Win Order from the Best to the worst Move has a Progressive Score assigned to each Square!

This will be interesting to say the least.

Well, if we put our brains together, we should come up with something.

Could you explain how your current learning system works? What information does it "remember"? What do you check for?

Reply: Anthony as above! but also the Problem is having to Stop! the Program after each Game and then Copy & Paste the Learning into the Learn SUB I would like to make that Part Fully Automated...so that it learns in Real Time! and somehow Loads the Learnt DATA After a Game back into the Program ready for the Next Game Automatically ...and that's the part that has always Stumped Me! Sad

What I saw when I ran your demo was amazing, and how you could add data to make it smarter.

You know, now that I am thinking about it, if we make this artificially intelligent learning system work for Tic-Tac-Toe, we can make it work for bigger games like, Black Jack 21, Connect 4, Chess, Poker, Rummy, or even Go Fish! The possibilities are endless.

Reply: Anthony BIG SMILE! Exactly Walter this has always been My Dream! and I think this little O&X Program is so Near! I can taste it...
As far as I can understand how to do it...it would be like Writing & Reading DATA Into and out of the Program...while it's Running! So maybe the Program would have to use DATA Arrays instead of the way it is! ? 


Thanks,
Walter Whitman
The Joyful Programmer


Reply: Anthony

The program is Not! that Big! Walter I think about 600 lines of code! and lot's of it is are Remarks explaining what everything does! (I always make loads of Remarks...because sometimes I Steal code from One Program and put it in another!) Smile

You could Print it off and cut Out the Sections! and Number them in Order! then look at them on a Table to get a Clearer view of the whole Program! (I have done this before!) Oops!...

Please ask me about how anything works! and I will explain it more Clearly!

Cheers Walter...We will Crack it!


Anthony.
Reply
#14
Walter Below & Attached is a Version of the O&X Program where I played (36) Games against it! just to see how Good it becomes after Learning...and Now it is Quite Strong! try it... Cool
The Games were Played with the Computer (X) going first and then we Played alternately...Plus the Games are Now separated from the last Game...and show who last moved Etc. So you have quite a bit of Game DATA to Study...
Considering there are a Brute force amount of possible Moves that can be Played = (9x8x7x6x5x4x3x2x1) =  362,880 then (36) Games is Not a lot...but it amazed Me just how much better it Now plays! 
Another way of looking at How strong the Program is after only (36) Games is 36x9 = Not quite 3,600 plus some of the Games were less than 9 Moves long! but close to being .1% from the 362,880 above! Which Now makes it's Playing at a Rough .1% of it's possible Strength! 
I can't wait till we somehow figure out how to fully Automate it to Play & learn on it's Own...when we make the Dream Version! Wink


Anthony.


Code:
DECLARE SUB LEARNDATA1 ()

DIM SHARED LASTDRAWN AS STRING
DIM SHARED COMP01RVAL AS INTEGER
DIM SHARED COMP02RVAL AS INTEGER
DIM SHARED GAMETYP AS INTEGER
DIM SHARED WHOMFST AS STRING
DIM SHARED MOVTYPN AS STRING
DIM SHARED MOVTYPR AS STRING
DIM SHARED MOVMADE AS STRING
DIM SHARED HUMANMOVED AS INTEGER
DIM SHARED COMP01MOVED AS INTEGER
DIM SHARED COMP02MOVED AS INTEGER
DIM SHARED COMPMAXVAL AS LONG
DIM SHARED AVV AS INTEGER
DIM SHARED BVV AS INTEGER
DIM SHARED CVV AS INTEGER
DIM SHARED DVV AS INTEGER
DIM SHARED EVV AS INTEGER
DIM SHARED FVV AS INTEGER
DIM SHARED GVV AS INTEGER
DIM SHARED HVV AS INTEGER
DIM SHARED IVV AS INTEGER
DIM SHARED P001 AS STRING
DIM SHARED P002 AS STRING
DIM SHARED P003 AS STRING
DIM SHARED P004 AS STRING
DIM SHARED P005 AS STRING
DIM SHARED P006 AS STRING
DIM SHARED P007 AS STRING
DIM SHARED P008 AS STRING
DIM SHARED P009 AS STRING
DIM SHARED P001VN AS STRING
DIM SHARED P002VN AS STRING
DIM SHARED P003VN AS STRING
DIM SHARED P004VN AS STRING
DIM SHARED P005VN AS STRING
DIM SHARED P006VN AS STRING
DIM SHARED P007VN AS STRING
DIM SHARED P008VN AS STRING
DIM SHARED P009VN AS STRING
DIM SHARED P001VR AS STRING
DIM SHARED P002VR AS STRING
DIM SHARED P003VR AS STRING
DIM SHARED P004VR AS STRING
DIM SHARED P005VR AS STRING
DIM SHARED P006VR AS STRING
DIM SHARED P007VR AS STRING
DIM SHARED P008VR AS STRING
DIM SHARED P009VR AS STRING
DIM SHARED PTEMPVALN AS STRING
DIM SHARED PTEMPVALR AS STRING
DIM SHARED MOVTYP000N AS STRING
DIM SHARED MOVTYP001N AS STRING
DIM SHARED MOVTYP002N AS STRING
DIM SHARED MOVTYP003N AS STRING
DIM SHARED MOVTYP004N AS STRING
DIM SHARED MOVTYP005N AS STRING
DIM SHARED MOVTYP006N AS STRING
DIM SHARED MOVTYP007N AS STRING
DIM SHARED MOVTYP008N AS STRING
DIM SHARED MOVTYP009N AS STRING
DIM SHARED MOVTYP000R AS STRING
DIM SHARED MOVTYP001R AS STRING
DIM SHARED MOVTYP002R AS STRING
DIM SHARED MOVTYP003R AS STRING
DIM SHARED MOVTYP004R AS STRING
DIM SHARED MOVTYP005R AS STRING
DIM SHARED MOVTYP006R AS STRING
DIM SHARED MOVTYP007R AS STRING
DIM SHARED MOVTYP008R AS STRING
DIM SHARED MOVTYP009R AS STRING
DIM SHARED MOVREG000N AS STRING
DIM SHARED MOVREG001N AS STRING
DIM SHARED MOVREG002N AS STRING
DIM SHARED MOVREG003N AS STRING
DIM SHARED MOVREG004N AS STRING
DIM SHARED MOVREG005N AS STRING
DIM SHARED MOVREG006N AS STRING
DIM SHARED MOVREG007N AS STRING
DIM SHARED MOVREG008N AS STRING
DIM SHARED MOVREG009N AS STRING
DIM SHARED MOVREG000R AS STRING
DIM SHARED MOVREG001R AS STRING
DIM SHARED MOVREG002R AS STRING
DIM SHARED MOVREG003R AS STRING
DIM SHARED MOVREG004R AS STRING
DIM SHARED MOVREG005R AS STRING
DIM SHARED MOVREG006R AS STRING
DIM SHARED MOVREG007R AS STRING
DIM SHARED MOVREG008R AS STRING
DIM SHARED MOVREG009R AS STRING
DIM SHARED MOVSCOUNT AS INTEGER
DIM SHARED MOVSCTDWN AS INTEGER
DIM SHARED WLINE001 AS STRING
DIM SHARED WLINE002 AS STRING
DIM SHARED WLINE003 AS STRING
DIM SHARED WLINE004 AS STRING
DIM SHARED WLINE005 AS STRING
DIM SHARED WLINE006 AS STRING
DIM SHARED WLINE007 AS STRING
DIM SHARED WLINE008 AS STRING
DIM SHARED GMOVERO AS INTEGER
DIM SHARED GMOVERX AS INTEGER
DIM SHARED GMOVERD AS INTEGER
DIM SHARED DRAWNSAVEDONE AS INTEGER
SCREEN 11
REM-----------------------------------------------------------------------------------------------------------
CLS
PRINT : PRINT
PRINT TAB(11); "OXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXO"
PRINT : PRINT
PRINT TAB(90); "  { OXAUTOLN3-36-GMS-LNT } O&X AUTO SELF LEARNING PROGRAM!  "
PRINT : PRINT
PRINT TAB(90); "       ORIGINAL-V1.23/02/2002 THIS VERSION-V3.05/07/2014 "
PRINT : PRINT
PRINT TAB(90); "             NOTICE! THIS VERSION NOT! COMPLETED ? "
PRINT : PRINT
PRINT TAB(90); "                NOW! WITH OPTIMISED START A.I. :) "
PRINT : PRINT
PRINT TAB(90); "              PLUS BETTER GRAPHICS BOARD & PIECES "
PRINT : PRINT
PRINT TAB(90); "       LEARNING NOW! AUTO SAVED & LEARNT IN O&XDATA.TXT ? "
PRINT : PRINT
PRINT TAB(90); "                 BY, [A][R][B] COMPUTER SOFTWARE. "
PRINT : PRINT
PRINT TAB(11); "OXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXOXO"
PRINT : PRINT
INPUT " PRESS (ENTER) TO START PROGRAM! "; XYZ$
LASTDRAWNINPUT:
CLS
PRINT : PRINT
INPUT " WAS THE LAST GAME A DRAWN GAME! ENTER (Y) OR (N) "; LASTDRAWN
IF LASTDRAWN = "y" THEN LASTDRAWN = "Y"
IF LASTDRAWN = "n" THEN LASTDRAWN = "N"
IF LASTDRAWN = "Y" THEN GOTO START
IF LASTDRAWN = "N" THEN GOTO START
GOTO LASTDRAWNINPUT
REM-----------------------------------------------------------------------------------------------------------
START:
CLS
REM BELOW GIVE MAIN BOARD REGISTER START VARIABLES! A STRING EMPTY SQUARE VALUE!
P001VN = "E": P002VN = "E": P003VN = "E"
P004VN = "E": P005VN = "E": P006VN = "E"
P007VN = "E": P008VN = "E": P009VN = "E"
PTEMPVALN = P001VN + P002VN + P003VN + P004VN + P005VN + P006VN + P007VN + P008VN + P009VN
REM BELOW REVERSE LEARNING BOARD REGISTER START VARIABLES!
P001VR = "E": P002VR = "E": P003VR = "E"
P004VR = "E": P005VR = "E": P006VR = "E"
P007VR = "E": P008VR = "E": P009VR = "E"
PTEMPVALR = P001VR + P002VR + P003VR + P004VR + P005VR + P006VR + P007VR + P008VR + P009VR
PRINT : PRINT
INPUT " ENTER GAME TYPE!  HUMAN V COMPUTER = 1  COMPUTER V COMPUTER = 2  "; GAMETYP
IF GAMETYP = 1 THEN GOTO WHOMOVESFIRST
IF GAMETYP = 2 THEN GOTO COMPRANDOMSTART
GOTO START
REM-----------------------------------------------------------------------------------------------------------
WHOMOVESFIRST:
CLS
PRINT : PRINT
INPUT " ENTER WHO MOVES FIRST!  HUMAN = (O)  COMPUTER = (X)  "; WHOMFST
IF WHOMFST = "o" THEN WHOMFST = "O"
IF WHOMFST = "x" THEN WHOMFST = "X"
IF WHOMFST = "O" THEN MOVTYPN = ""
IF WHOMFST = "O" THEN GOSUB BOARD
IF WHOMFST = "O" THEN GOTO HUMAN
IF WHOMFST = "X" THEN MOVTYPN = ""
IF WHOMFST = "X" THEN GOSUB BOARD
IF WHOMFST = "X" THEN GOTO COMPUTER01
GOTO WHOMOVESFIRST
REM-----------------------------------------------------------------------------------------------------------
COMPRANDOMSTART:
RANDOMIZE TIMER
COMPRAND12 = INT(RND * 100) + 1
IF COMPRAND12 < 50 THEN MOVTYPN = ""
IF COMPRAND12 < 50 THEN GOSUB BOARD
IF COMPRAND12 < 50 THEN GOTO COMPUTER01
IF COMPRAND12 > 50 THEN MOVTYPN = ""
IF COMPRAND12 > 50 THEN GOSUB BOARD
IF COMPRAND12 > 50 THEN GOTO COMPUTER02
GOTO COMPRANDOMSTART
REM-----------------------------------------------------------------------------------------------------------
BOARD:
CLS
REM BELOW PRINT ALL MOVES MADE ONTO THE BOARD!
IF MOVMADE = "A" AND P001 = "" THEN P001 = MOVTYPN
IF MOVMADE = "B" AND P002 = "" THEN P002 = MOVTYPN
IF MOVMADE = "C" AND P003 = "" THEN P003 = MOVTYPN
IF MOVMADE = "D" AND P004 = "" THEN P004 = MOVTYPN
IF MOVMADE = "E" AND P005 = "" THEN P005 = MOVTYPN
IF MOVMADE = "F" AND P006 = "" THEN P006 = MOVTYPN
IF MOVMADE = "G" AND P007 = "" THEN P007 = MOVTYPN
IF MOVMADE = "H" AND P008 = "" THEN P008 = MOVTYPN
IF MOVMADE = "I" AND P009 = "" THEN P009 = MOVTYPN
PRINT : PRINT : PRINT : PRINT
PRINT TAB(20); "(A)= "; P001; TAB(40); "(B)= "; P002; TAB(60); "(C)= "; P003
PRINT : PRINT : PRINT : PRINT : PRINT
PRINT TAB(20); "(D)= "; P004; TAB(40); "(E)= "; P005; TAB(60); "(F)= "; P006
PRINT : PRINT : PRINT : PRINT : PRINT
PRINT TAB(20); "(G)= "; P007; TAB(40); "(H)= "; P008; TAB(60); "(I)= "; P009
PRINT : PRINT : PRINT : PRINT
IF MOVTYPN = "" THEN RETURN: REM BACK TO HUMAN (NO INPUT) OR COMPUTERS AT RANDOM START!
REM BELOW MAIN BOARD POSITION! MOVE REGISTER VARIABLES!
IF P001 <> "" AND P001VN = "E" THEN P001VN = MOVTYPN
IF P002 <> "" AND P002VN = "E" THEN P002VN = MOVTYPN
IF P003 <> "" AND P003VN = "E" THEN P003VN = MOVTYPN
IF P004 <> "" AND P004VN = "E" THEN P004VN = MOVTYPN
IF P005 <> "" AND P005VN = "E" THEN P005VN = MOVTYPN
IF P006 <> "" AND P006VN = "E" THEN P006VN = MOVTYPN
IF P007 <> "" AND P007VN = "E" THEN P007VN = MOVTYPN
IF P008 <> "" AND P008VN = "E" THEN P008VN = MOVTYPN
IF P009 <> "" AND P009VN = "E" THEN P009VN = MOVTYPN
REM BELOW MAIN BOARD POSITION! MOVE REGISTER REVERSE VARIABLES!
REM BELOW SET TYPE(R) VARIABLES FOR REVERSE MOVES LEARNING!
IF MOVTYPN = "O" THEN MOVTYPR = "X"
IF MOVTYPN = "X" THEN MOVTYPR = "O"
IF P001 <> "" AND P001VR = "E" THEN P001VR = MOVTYPR
IF P002 <> "" AND P002VR = "E" THEN P002VR = MOVTYPR
IF P003 <> "" AND P003VR = "E" THEN P003VR = MOVTYPR
IF P004 <> "" AND P004VR = "E" THEN P004VR = MOVTYPR
IF P005 <> "" AND P005VR = "E" THEN P005VR = MOVTYPR
IF P006 <> "" AND P006VR = "E" THEN P006VR = MOVTYPR
IF P007 <> "" AND P007VR = "E" THEN P007VR = MOVTYPR
IF P008 <> "" AND P008VR = "E" THEN P008VR = MOVTYPR
IF P009 <> "" AND P009VR = "E" THEN P009VR = MOVTYPR
REM-----------------------------------------------------------------------------------------------------------
REM BELOW MAIN BOARD POSITIONS! NORMAL AND REVERSE LEARNING REGISTER VARIABLES!
PTEMPVALN = P001VN + P002VN + P003VN + P004VN + P005VN + P006VN + P007VN + P008VN + P009VN
PTEMPVALR = P001VR + P002VR + P003VR + P004VR + P005VR + P006VR + P007VR + P008VR + P009VR
MOVREGISTER000: REM BELOW MOVE (0) NORMAL AND REVERSE MOVE REGISTERS!
REM NOTICE!! THIS IS THE FIRST BEST MOVE EMPTY BOARD REGISTER! SO DIFFERENT!
IF MOVREG000N <> "" THEN GOTO MOVREGISTER001
MOVREG000N = "EEEEEEEEE": MOVTYP000N = MOVMADE
MOVREG000R = "EEEEEEEEE": MOVTYP000R = MOVMADE
REM NOTICE!! NO IMMEDIATE BRANCH TO (WINCHECKS) AS BOTH FIRST (2) REGISTERS DONE AT SAME TIME!
MOVREGISTER001: REM BELOW MOVE (1) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG001N <> "" THEN GOTO MOVREGISTER002
MOVSCOUNT = MOVSCOUNT + 1
MOVREG001N = PTEMPVALN: MOVTYP001N = MOVMADE
MOVREG001R = PTEMPVALR: MOVTYP001R = MOVMADE
GOTO WINCHECKS
MOVREGISTER002: REM BELOW MOVE (2) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG002N <> "" THEN GOTO MOVREGISTER003
MOVSCOUNT = MOVSCOUNT + 1
MOVREG002N = PTEMPVALN: MOVTYP002N = MOVMADE
MOVREG002R = PTEMPVALR: MOVTYP002R = MOVMADE
GOTO WINCHECKS
MOVREGISTER003: REM BELOW MOVE (3) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG003N <> "" THEN GOTO MOVREGISTER004
MOVSCOUNT = MOVSCOUNT + 1
MOVREG003N = PTEMPVALN: MOVTYP003N = MOVMADE
MOVREG003R = PTEMPVALR: MOVTYP003R = MOVMADE
GOTO WINCHECKS
MOVREGISTER004: REM BELOW MOVE (4) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG004N <> "" THEN GOTO MOVREGISTER005
MOVSCOUNT = MOVSCOUNT + 1
MOVREG004N = PTEMPVALN: MOVTYP004N = MOVMADE
MOVREG004R = PTEMPVALR: MOVTYP004R = MOVMADE
GOTO WINCHECKS
MOVREGISTER005: REM BELOW MOVE (5) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG005N <> "" THEN GOTO MOVREGISTER006
MOVSCOUNT = MOVSCOUNT + 1
MOVREG005N = PTEMPVALN: MOVTYP005N = MOVMADE
MOVREG005R = PTEMPVALR: MOVTYP005R = MOVMADE
GOTO WINCHECKS
MOVREGISTER006: REM BELOW MOVE (6) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG006N <> "" THEN GOTO MOVREGISTER007
MOVSCOUNT = MOVSCOUNT + 1
MOVREG006N = PTEMPVALN: MOVTYP006N = MOVMADE
MOVREG006R = PTEMPVALR: MOVTYP006R = MOVMADE
GOTO WINCHECKS
MOVREGISTER007: REM BELOW MOVE (7) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG007N <> "" THEN GOTO MOVREGISTER008
MOVSCOUNT = MOVSCOUNT + 1
MOVREG007N = PTEMPVALN: MOVTYP007N = MOVMADE
MOVREG007R = PTEMPVALR: MOVTYP007R = MOVMADE
GOTO WINCHECKS
MOVREGISTER008: REM BELOW MOVE (8) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG008N <> "" THEN GOTO MOVREGISTER009
MOVSCOUNT = MOVSCOUNT + 1
MOVREG008N = PTEMPVALN: MOVTYP008N = MOVMADE
MOVREG008R = PTEMPVALR: MOVTYP008R = MOVMADE
GOTO WINCHECKS
MOVREGISTER009: REM BELOW MOVE (9) NORMAL AND REVERSE MOVE REGISTERS!
IF MOVREG009N <> "" THEN GOTO WINCHECKS
MOVSCOUNT = MOVSCOUNT + 1
MOVREG009N = PTEMPVALN: MOVTYP009N = MOVMADE
MOVREG009R = PTEMPVALR: MOVTYP009R = MOVMADE
REM-----------------------------------------------------------------------------------------------------------
WINCHECKS: REM BELOW CHECK IF ANY OF THE (8) WINNING LINES HAVE BEEN MADE!
WLINE001 = P001 + P002 + P003
WLINE002 = P004 + P005 + P006
WLINE003 = P007 + P008 + P009
WLINE004 = P001 + P004 + P007
WLINE005 = P002 + P005 + P008
WLINE006 = P003 + P006 + P009
WLINE007 = P001 + P005 + P009
WLINE008 = P003 + P005 + P007
IF WLINE001 = "OOO" THEN GMOVERO = 1
IF WLINE002 = "OOO" THEN GMOVERO = 1
IF WLINE003 = "OOO" THEN GMOVERO = 1
IF WLINE004 = "OOO" THEN GMOVERO = 1
IF WLINE005 = "OOO" THEN GMOVERO = 1
IF WLINE006 = "OOO" THEN GMOVERO = 1
IF WLINE007 = "OOO" THEN GMOVERO = 1
IF WLINE008 = "OOO" THEN GMOVERO = 1
IF WLINE001 = "XXX" THEN GMOVERX = 1
IF WLINE002 = "XXX" THEN GMOVERX = 1
IF WLINE003 = "XXX" THEN GMOVERX = 1
IF WLINE004 = "XXX" THEN GMOVERX = 1
IF WLINE005 = "XXX" THEN GMOVERX = 1
IF WLINE006 = "XXX" THEN GMOVERX = 1
IF WLINE007 = "XXX" THEN GMOVERX = 1
IF WLINE008 = "XXX" THEN GMOVERX = 1
REM BELOW CHECK IF ALL MOVES HAVE BEEN MADE!
IF MOVSCOUNT >= 9 THEN GMOVERD = 1
REM BELOW REGISTER WHO HAS JUST MADE A MOVE!
IF GAMETYP = 1 AND MOVTYPN = "O" THEN HUMANMOVED = 1
IF GAMETYP = 1 AND MOVTYPN = "X" THEN COMP01MOVED = 1
IF GAMETYP = 2 AND MOVTYPN = "X" THEN COMP01MOVED = 1
IF GAMETYP = 2 AND MOVTYPN = "O" THEN COMP02MOVED = 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
HUMAN:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
HUMANMOVED = 0
HUMANINPUT:
MOVMADE = ""
MOVTYPN = "O"
INPUT " HUMANS MOVE! ENTER THE LETTER (A - I) FOR YOUR MOVE!  "; MOVMADE
IF MOVMADE = "a" THEN MOVMADE = "A"
IF MOVMADE = "b" THEN MOVMADE = "B"
IF MOVMADE = "c" THEN MOVMADE = "C"
IF MOVMADE = "d" THEN MOVMADE = "D"
IF MOVMADE = "e" THEN MOVMADE = "E"
IF MOVMADE = "f" THEN MOVMADE = "F"
IF MOVMADE = "g" THEN MOVMADE = "G"
IF MOVMADE = "h" THEN MOVMADE = "H"
IF MOVMADE = "i" THEN MOVMADE = "I"
IF MOVMADE = "A" AND P001 = "" THEN GOSUB BOARD
IF MOVMADE = "B" AND P002 = "" THEN GOSUB BOARD
IF MOVMADE = "C" AND P003 = "" THEN GOSUB BOARD
IF MOVMADE = "D" AND P004 = "" THEN GOSUB BOARD
IF MOVMADE = "E" AND P005 = "" THEN GOSUB BOARD
IF MOVMADE = "F" AND P006 = "" THEN GOSUB BOARD
IF MOVMADE = "G" AND P007 = "" THEN GOSUB BOARD
IF MOVMADE = "H" AND P008 = "" THEN GOSUB BOARD
IF MOVMADE = "I" AND P009 = "" THEN GOSUB BOARD
IF GAMETYP = 1 AND HUMANMOVED = 1 THEN GOTO COMPUTER01
MOVTYPN = "": REM MAKES RETURN FROM BOARD WORK! AS NO MOVE INPUT MADE!
GOSUB BOARD
GOTO HUMANINPUT
REM-----------------------------------------------------------------------------------------------------------
COMPUTER01:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
COMP01MOVED = 0
MOVMADE = ""
MOVTYPN = "X"
PRINT " COMPUTER01 THINKING!........................................................."
CALL LEARNDATA1: REM CALL MAIN LEARNING DATA SUBS FOR BEST MOVE VALUES!
COMPMAXVAL = 1000000
IF LASTDRAWN = "Y" THEN GOTO COMP01RNDSTART
COMPUTER01INPUT:
REM BELOW NOW! OPTIMISED :)
IF EVV >= COMPMAXVAL AND P005 = "" THEN MOVMADE = "E"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF AVV >= COMPMAXVAL AND P001 = "" THEN MOVMADE = "A"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF IVV >= COMPMAXVAL AND P009 = "" THEN MOVMADE = "I"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF CVV >= COMPMAXVAL AND P003 = "" THEN MOVMADE = "C"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF GVV >= COMPMAXVAL AND P007 = "" THEN MOVMADE = "G"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF BVV >= COMPMAXVAL AND P002 = "" THEN MOVMADE = "B"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF HVV >= COMPMAXVAL AND P008 = "" THEN MOVMADE = "H"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF DVV >= COMPMAXVAL AND P004 = "" THEN MOVMADE = "D"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE01
IF FVV >= COMPMAXVAL AND P006 = "" THEN MOVMADE = "F"
COMPMAKEMOVE01:
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 1 AND COMP01MOVED = 1 THEN GOTO HUMAN
IF GAMETYP = 2 AND COMP01MOVED = 1 THEN GOTO COMPUTER02
COMPMAXVAL = COMPMAXVAL - 1
GOTO COMPUTER01INPUT
COMP01RNDSTART:
LASTDRAWN = "": REM LAST DRAWN GAME FIRST MOVE! NOW MADE!
RANDOMIZE TIMER
COMP01RVAL = INT(RND * 10) + 1
REM BELOW NOW! OPTIMISED :)
IF COMP01RVAL = 5 AND P005 = "" THEN MOVMADE = "E"
IF COMP01RVAL = 1 AND P001 = "" THEN MOVMADE = "A"
IF COMP01RVAL = 9 AND P009 = "" THEN MOVMADE = "I"
IF COMP01RVAL = 3 AND P003 = "" THEN MOVMADE = "C"
IF COMP01RVAL = 7 AND P007 = "" THEN MOVMADE = "G"
IF COMP01RVAL = 2 AND P002 = "" THEN MOVMADE = "B"
IF COMP01RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP01RVAL = 4 AND P004 = "" THEN MOVMADE = "D"
IF COMP01RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP01RVAL = 6 AND P006 = "" THEN MOVMADE = "F"
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 1 AND COMP01MOVED = 1 THEN GOTO HUMAN
IF GAMETYP = 2 AND COMP01MOVED = 1 THEN GOTO COMPUTER02
GOTO COMP01RNDSTART
REM-----------------------------------------------------------------------------------------------------------
COMPUTER02:
IF GMOVERO = 1 THEN GOTO GAMENDLEARN
IF GMOVERX = 1 THEN GOTO GAMENDLEARN
IF GMOVERD = 1 THEN GOTO RESTART
COMP02MOVED = 0
MOVMADE = ""
MOVTYPN = "O"
PRINT " COMPUTER02 THINKING!........................................................."
CALL LEARNDATA1: REM CALL MAIN LEARNING DATA SUBS FOR BEST MOVE VALUES!
COMPMAXVAL = 1000000
IF LASTDRAWN = "Y" THEN GOTO COMP02RNDSTART
COMPUTER02INPUT:
REM BELOW NOW! OPTIMISED :)
IF EVV >= COMPMAXVAL AND P005 = "" THEN MOVMADE = "E"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF AVV >= COMPMAXVAL AND P001 = "" THEN MOVMADE = "A"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF IVV >= COMPMAXVAL AND P009 = "" THEN MOVMADE = "I"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF CVV >= COMPMAXVAL AND P003 = "" THEN MOVMADE = "C"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF GVV >= COMPMAXVAL AND P007 = "" THEN MOVMADE = "G"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF BVV >= COMPMAXVAL AND P002 = "" THEN MOVMADE = "B"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF HVV >= COMPMAXVAL AND P008 = "" THEN MOVMADE = "H"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF DVV >= COMPMAXVAL AND P004 = "" THEN MOVMADE = "D"
IF MOVMADE <> "" THEN GOTO COMPMAKEMOVE02
IF FVV >= COMPMAXVAL AND P006 = "" THEN MOVMADE = "F"
COMPMAKEMOVE02:
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 2 AND COMP02MOVED = 1 THEN GOTO COMPUTER01
COMPMAXVAL = COMPMAXVAL - 1
GOTO COMPUTER02INPUT
COMP02RNDSTART:
LASTDRAWN = "": REM LAST DRAWN GAME FIRST MOVE! NOW MADE!
RANDOMIZE TIMER
COMP02RVAL = INT(RND * 10) + 1
REM BELOW NOW! OPTIMISED :)
IF COMP02RVAL = 5 AND P005 = "" THEN MOVMADE = "E"
IF COMP02RVAL = 1 AND P001 = "" THEN MOVMADE = "A"
IF COMP02RVAL = 9 AND P009 = "" THEN MOVMADE = "I"
IF COMP02RVAL = 3 AND P003 = "" THEN MOVMADE = "C"
IF COMP02RVAL = 7 AND P007 = "" THEN MOVMADE = "G"
IF COMP02RVAL = 2 AND P002 = "" THEN MOVMADE = "B"
IF COMP02RVAL = 8 AND P008 = "" THEN MOVMADE = "H"
IF COMP02RVAL = 4 AND P004 = "" THEN MOVMADE = "D"
IF COMP02RVAL = 6 AND P006 = "" THEN MOVMADE = "F"
IF MOVMADE <> "" THEN GOSUB BOARD: REM BEST MOVE NOW FOUND!
REM BELOW MAIN BRANCH TO WHO THIS COMPUTER IS PLAYING AGAINST!
IF GAMETYP = 2 AND COMP02MOVED = 1 THEN GOTO COMPUTER01
GOTO COMP02RNDSTART
REM-----------------------------------------------------------------------------------------------------------
GAMENDLEARN:
MOVSCTDWN = 13: REM MAX SCORE VALUE COUNT DOWN VARIABLE!
OXDATA$ = "O&XDATA.TXT"
OPEN OXDATA$ FOR APPEND AS #1: REM NOW LEARNT DATA SAVED!
REM BELOW (9) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN9
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN7
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 9 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 9 THEN GOTO MOVSLEARNEND
REM BELOW (8) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN8
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN6
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN4
IF MOVSCOUNT = 8 THEN GOSUB MOVSLEARN2
IF MOVSCOUNT = 8 THEN GOTO MOVSLEARNEND
REM BELOW (7) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN7
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 7 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 7 THEN GOTO MOVSLEARNEND
REM BELOW (6) MOVES GAME PLAYED LEARNING BRANCHES!
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN6
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN4
IF MOVSCOUNT = 6 THEN GOSUB MOVSLEARN2
IF MOVSCOUNT = 6 THEN GOTO MOVSLEARNEND
REM BELOW (5) MOVES GAME PLAYED LEARNING BRANCHES!
REM NOTICE! QUICKEST WIN! POSSIBLE!
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN5
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN3
IF MOVSCOUNT = 5 THEN GOSUB MOVSLEARN1
IF MOVSCOUNT = 5 THEN GOTO MOVSLEARNEND
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN9: REM BELOW LEARN BLOCK (9) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG008R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009N; "VV = "; MOVTYP009N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP009R; "VV = "; MOVTYP009R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN8: REM BELOW LEARN BLOCK (8) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG007R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008N; "VV = "; MOVTYP008N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP008R; "VV = "; MOVTYP008R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN7: REM BELOW LEARN BLOCK (7) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG006R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007N; "VV = "; MOVTYP007N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP007R; "VV = "; MOVTYP007R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN6: REM BELOW LEARN BLOCK (6) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG005R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006N; "VV = "; MOVTYP006N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP006R; "VV = "; MOVTYP006R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN5: REM BELOW LEARN BLOCK (5) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG004R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005N; "VV = "; MOVTYP005N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP005R; "VV = "; MOVTYP005R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN4: REM BELOW LEARN BLOCK (4) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG003R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THIS IS (1) DEFENCE MOVE!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004N; "VV = "; MOVTYP004N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP004R; "VV = "; MOVTYP004R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN3: REM BELOW LEARN BLOCK (3) MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
REM NOTICE! MOVTYPN & MOVTYPR REVERSED BELOW! AS THESE ARE (2) DEFENCE MOVES!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG002R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003N; "VV = "; MOVTYP003N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP003R; "VV = "; MOVTYP003R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN2: REM BELOW LEARN BLOCK (2) (2nd PLAYERS FIRST MOVE)!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP002N; "VV = "; MOVTYP002N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG001R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP002R; "VV = "; MOVTYP002R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
REM-----------------------------------------------------------------------------------------------------------
MOVSLEARN1: REM BELOW LEARN BLOCK (1) (1st PLAYERS FIRST MOVE)! EMPTY BOARD!
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPN; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG000N; CHR$(34);
PRINT #1, " THEN  "; MOVTYP000N; "VV = "; MOVTYP000N; "VV + "; MOVSCTDWN
PRINT #1, "IF MOVTYPN = "; CHR$(34); MOVTYPR; CHR$(34); " AND PTEMPVALN = "; CHR$(34); MOVREG000R; CHR$(34);
PRINT #1, " THEN  "; MOVTYP000R; "VV = "; MOVTYP000R; "VV + "; MOVSCTDWN
MOVSCTDWN = MOVSCTDWN - 1
RETURN
MOVSLEARNEND:
PRINT #1, "REM --------------Last-Complete-Game-Learnt-Above--(?)-Goes-1st-Game-001 "
CLOSE
REM-----------------------------------------------------------------------------------------------------------
RESTART:
IF GMOVERO = 1 THEN GOTO WINPRINTOUT
IF GMOVERX = 1 THEN GOTO WINPRINTOUT
PRINT "    ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW! ITS A DRAW!"
GOTO NEWGAMEINPUT
WINPRINTOUT:
IF GMOVERO = 1 THEN PRINT "(O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS! (O) WINS!"
IF GMOVERX = 1 THEN PRINT "(X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS! (X) WINS!"
NEWGAMEINPUT:
PRINT
INPUT " PRESS (ENTER) FOR ANOTHER GAME! OR (QU) TO QUIT! "; QUIT$
IF QUIT$ = "QU" THEN END
IF QUIT$ = "qu" THEN END
RUN
GOTO NEWGAMEINPUT

SUB LEARNDATA1
REM BELOW GAME LEARNING DEMONSTRATION! A.R.B v COMPUTER Alternating Who Goes First! 
REM COMPUTER STARTED THE GAMES PLAYING (X) I PLAY (O) TOTAL OF (36) GAMES PLAYED.
REM NOW! PLAY AGAINST THE COMPUTER TO SEE HOW MUCH STRONGER IT IS! :)
REM P.S WHEN YOU PLAY AGAINST THE PROGRAM THE GAMES ARE NOW! SEPERATED LIKE THIS EXAMPLE
REM YOU ONLY HAVE TO RE-NUMBER THE GAMES! AND WHO GOES 1st STARTING FROM 001
REM -----------------------------------------------------------------
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEXEOEX" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEOEXEO" THEN  DVV = DVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEOEX" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEXEO" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEOEX" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEXEO" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEEEX" THEN  GVV = GVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEEEO" THEN  GVV = GVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEEEE" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEEEE" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEEEE" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEEEE" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  AVV = AVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  AVV = AVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-001 
IF MOVTYPN = "O" AND PTEMPVALN = "XEXOOEXEO" THEN  FVV = FVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEOXXEOEX" THEN  FVV = FVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXOOEXEO" THEN  FVV = FVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOXXEOEX" THEN  FVV = FVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEOOEXEO" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEXXEOEX" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEXEO" THEN  DVV = DVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEOEX" THEN  DVV = DVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEXEO" THEN  DVV = DVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEOEX" THEN  DVV = DVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEEEO" THEN  DVV = DVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEEEX" THEN  DVV = DVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEEEE" THEN  IVV = IVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEEEE" THEN  IVV = IVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEEEE" THEN  IVV = IVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEEEE" THEN  IVV = IVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  IVV = IVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  IVV = IVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-002
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEXEXEO" THEN  FVV = FVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEOEOEX" THEN  FVV = FVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEXEEEO" THEN  FVV = FVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEOEEEX" THEN  FVV = FVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEXEEEO" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEOEEEX" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEXEEEO" THEN  CVV = CVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEOEEEX" THEN  CVV = CVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  IVV = IVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  IVV = IVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-003 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEOEEEX" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEXEEEO" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEOEEEX" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEXEEEO" THEN  GVV = GVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEOEEEX" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEXEEEO" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  CVV = CVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  CVV = CVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  CVV = CVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-004 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOEXEXEX" THEN  BVV = BVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXEOEOEO" THEN  BVV = BVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOEXEXEE" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXEOEOEE" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEXEXEE" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEOEOEE" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEXEE" THEN  CVV = CVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEOEE" THEN  CVV = CVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEEEE" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEEEE" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEEEE" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEEEE" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  AVV = AVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  AVV = AVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-005 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEOOEEEX" THEN  FVV = FVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEXXEEEO" THEN  FVV = FVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEOOEEEX" THEN  FVV = FVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEXXEEEO" THEN  FVV = FVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEOOEEEE" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEXXEEEE" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEEEE" THEN  DVV = DVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEEEE" THEN  DVV = DVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEEEE" THEN  DVV = DVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEEEE" THEN  DVV = DVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  DVV = DVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  DVV = DVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-006 
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEXEOEO" THEN  HVV = HVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEOEXEX" THEN  HVV = HVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEXEOEO" THEN  HVV = HVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEOEXEX" THEN  HVV = HVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEXEOEO" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEOEXEX" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEXEOEE" THEN  IVV = IVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEOEXEE" THEN  IVV = IVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEOEE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEXEE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOEE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXEE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  GVV = GVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  GVV = GVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-007 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEOEOEX" THEN  HVV = HVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEXEXEO" THEN  HVV = HVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XOXEOEOEX" THEN  HVV = HVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OXOEXEXEO" THEN  HVV = HVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XOXEOEOEE" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OXOEXEXEE" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEOEOEE" THEN  BVV = BVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEXEXEE" THEN  BVV = BVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXEOEOEE" THEN  BVV = BVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOEXEXEE" THEN  BVV = BVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEOEE" THEN  BVV = BVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEXEE" THEN  BVV = BVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEEEE" THEN  GVV = GVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEEEE" THEN  GVV = GVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEEEE" THEN  GVV = GVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEEEE" THEN  GVV = GVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  GVV = GVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  GVV = GVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-008 
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEOOEEX" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEXXEEO" THEN  DVV = DVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEOOEEX" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEXXEEO" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEOOEEX" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEXXEEO" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEOEEEX" THEN  FVV = FVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEXEEEO" THEN  FVV = FVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  FVV = FVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  FVV = FVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEX" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEO" THEN  EVV = EVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-009 
REM THE LAST GAME DRAWN! SO FOR THE ABOVE GAME (X) PLAYED A RANDOM 1st MOVE.
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOOEEX" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXXEEO" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOOEEX" THEN  DVV = DVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXXEEO" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOOEEE" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXXEEE" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEEEE" THEN  FVV = FVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEEEE" THEN  FVV = FVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEEEE" THEN  FVV = FVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEEEE" THEN  FVV = FVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-010 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEXXOEO" THEN  HVV = HVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEOOXEX" THEN  HVV = HVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEXEOEO" THEN  HVV = HVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEOEXEX" THEN  HVV = HVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEXEOEO" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEOEXEX" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEXEEEO" THEN  GVV = GVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEOEEEX" THEN  GVV = GVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  IVV = IVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  IVV = IVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-011 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEOXEEEX" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEXOEEEO" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEOXEEEX" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEXOEEEO" THEN  GVV = GVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEOXEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEXOEEEE" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEOXEEEE" THEN  AVV = AVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEXOEEEE" THEN  AVV = AVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEOXEEEE" THEN  AVV = AVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEXOEEEE" THEN  AVV = AVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEOEEEEE" THEN  AVV = AVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEXEEEEE" THEN  AVV = AVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  DVV = DVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  DVV = DVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-012 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEXXOEEO" THEN  CVV = CVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEOOXEEX" THEN  CVV = CVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEXXOEEO" THEN  CVV = CVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEOOXEEX" THEN  CVV = CVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEXXOEEO" THEN  CVV = CVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEOOXEEX" THEN  CVV = CVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEXXOEEE" THEN  IVV = IVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEOOXEEE" THEN  IVV = IVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXOEEE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOXEEE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXOEEE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOXEEE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  FVV = FVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  FVV = FVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-013 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEXEOOE" THEN  IVV = IVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEOEXXE" THEN  IVV = IVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEXEOOE" THEN  IVV = IVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEOEXXE" THEN  IVV = IVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOOE" THEN  IVV = IVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXXE" THEN  IVV = IVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEOEE" THEN  HVV = HVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEXEE" THEN  HVV = HVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOEE" THEN  HVV = HVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXEE" THEN  HVV = HVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEOEE" THEN  HVV = HVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEXEE" THEN  HVV = HVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  GVV = GVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  GVV = GVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-014 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOXXEXOX" THEN  BVV = BVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXOOEOXO" THEN  BVV = BVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOXXEXOE" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXOOEOXE" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEOXXEXOE" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEXOOEOXE" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOXXEXOE" THEN  AVV = AVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXOOEOXE" THEN  AVV = AVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEXEXOE" THEN  AVV = AVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEOEOXE" THEN  AVV = AVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEXEXOE" THEN  AVV = AVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEOEOXE" THEN  AVV = AVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEXOE" THEN  CVV = CVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEOXE" THEN  CVV = CVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEOE" THEN  CVV = CVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEXE" THEN  CVV = CVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEOE" THEN  CVV = CVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEXE" THEN  CVV = CVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  HVV = HVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  HVV = HVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-015 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEXEEOO" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEOEEXX" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEXEEOO" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEOEEXX" THEN  GVV = GVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEOO" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEXX" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEOE" THEN  IVV = IVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEXE" THEN  IVV = IVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEOE" THEN  IVV = IVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEXE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEOE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEXE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  HVV = HVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  HVV = HVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-016 
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEXOXEX" THEN  HVV = HVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEOXOEO" THEN  HVV = HVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOEXOXEX" THEN  HVV = HVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXEOXOEO" THEN  HVV = HVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXOXEX" THEN  HVV = HVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOXOEO" THEN  HVV = HVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXOEEX" THEN  GVV = GVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOXEEO" THEN  GVV = GVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXOEEX" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOXEEO" THEN  GVV = GVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXOEEX" THEN  GVV = GVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOXEEO" THEN  GVV = GVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXOEEE" THEN  IVV = IVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOXEEE" THEN  IVV = IVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXOEEE" THEN  IVV = IVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOXEEE" THEN  IVV = IVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  IVV = IVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  IVV = IVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-017 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEXEOEO" THEN  HVV = HVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEOEXEX" THEN  HVV = HVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEXEOEO" THEN  HVV = HVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEOEXEX" THEN  HVV = HVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOEO" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXEX" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  GVV = GVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  GVV = GVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  GVV = GVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEO" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEX" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  IVV = IVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  IVV = IVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-018 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOXXEXOX" THEN  BVV = BVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXOOEOXO" THEN  BVV = BVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOEXEXOX" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXEOEOXO" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEXEXOX" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEOEOXO" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEXOX" THEN  CVV = CVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEOXO" THEN  CVV = CVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEEOX" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEEXO" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEEOX" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEEXO" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEOX" THEN  AVV = AVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEXO" THEN  AVV = AVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEOE" THEN  AVV = AVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEXE" THEN  AVV = AVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEOE" THEN  AVV = AVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEXE" THEN  AVV = AVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  HVV = HVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  HVV = HVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-019 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEOEOXX" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEXEXOO" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEOEOXX" THEN  DVV = DVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEXEXOO" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEOEOXE" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEXEXOE" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEOEOXE" THEN  AVV = AVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEXEXOE" THEN  AVV = AVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEOEOXE" THEN  AVV = AVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEXEXOE" THEN  AVV = AVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEOXE" THEN  AVV = AVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEXOE" THEN  AVV = AVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEOXE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEXOE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEOXE" THEN  EVV = EVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEXOE" THEN  EVV = EVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEOEE" THEN  EVV = EVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEXEE" THEN  EVV = EVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  GVV = GVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  GVV = GVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-020 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEXEXXO" THEN  FVV = FVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEOEOOX" THEN  FVV = FVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEXEXEO" THEN  FVV = FVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEOEOEX" THEN  FVV = FVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEXEXEO" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEOEOEX" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEXEXEE" THEN  IVV = IVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEOEOEE" THEN  IVV = IVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEXEEEE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEOEEEE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEXEEEE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEOEEEE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  CVV = CVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-021 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXEXEEOO" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOEOEEXX" THEN  GVV = GVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XOXEXEEOO" THEN  GVV = GVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OXOEOEEXX" THEN  GVV = GVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XOEEXEEOO" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OXEEOEEXX" THEN  GVV = GVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XOEEXEEOE" THEN  IVV = IVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OXEEOEEXE" THEN  IVV = IVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XOEEXEEOE" THEN  IVV = IVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "OXEEOEEXE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXEEOE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOEEXE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXEEEE" THEN  HVV = HVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOEEEE" THEN  HVV = HVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXEEEE" THEN  HVV = HVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOEEEE" THEN  HVV = HVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEEEEEE" THEN  HVV = HVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEEEEEE" THEN  HVV = HVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  BVV = BVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  BVV = BVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-022 
IF MOVTYPN = "O" AND PTEMPVALN = "EOOEXEXXE" THEN  AVV = AVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EXXEOEOOE" THEN  AVV = AVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EOOEXEEXE" THEN  AVV = AVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EXXEOEEOE" THEN  AVV = AVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EOOEXEEXE" THEN  AVV = AVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EXXEOEEOE" THEN  AVV = AVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXEEXE" THEN  CVV = CVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOEEOE" THEN  CVV = CVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXEEEE" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOEEEE" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXEEEE" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOEEEE" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  BVV = BVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  BVV = BVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-023 
IF MOVTYPN = "O" AND PTEMPVALN = "XOEOOEEXX" THEN  FVV = FVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OXEXXEEOO" THEN  FVV = FVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XOEOOEEXX" THEN  FVV = FVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OXEXXEEOO" THEN  FVV = FVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XOEOOEEXE" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OXEXXEEOE" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XOEEOEEXE" THEN  DVV = DVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OXEEXEEOE" THEN  DVV = DVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XOEEOEEXE" THEN  DVV = DVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "OXEEXEEOE" THEN  DVV = DVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEOEEXE" THEN  DVV = DVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEXEEOE" THEN  DVV = DVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEEEEXE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEEEEOE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEEEEXE" THEN  EVV = EVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEEEEOE" THEN  EVV = EVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEEEEEE" THEN  EVV = EVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEEEEEE" THEN  EVV = EVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  BVV = BVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  BVV = BVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-024 
IF MOVTYPN = "O" AND PTEMPVALN = "XXOOXEXEO" THEN  FVV = FVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OOXXOEOEX" THEN  FVV = FVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOOXEXEO" THEN  FVV = FVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXXOEOEX" THEN  FVV = FVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOOXEXEO" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXXOEOEX" THEN  FVV = FVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOOXEXEE" THEN  IVV = IVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXXOEOEE" THEN  IVV = IVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOOXEXEE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXXOEOEE" THEN  IVV = IVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOOXEXEE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXXOEOEE" THEN  IVV = IVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEOXEXEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEXOEOEE" THEN  CVV = CVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEOXEEEE" THEN  CVV = CVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEXOEEEE" THEN  CVV = CVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEOXEEEE" THEN  CVV = CVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEXOEEEE" THEN  CVV = CVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  DVV = DVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  DVV = DVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-025 
IF MOVTYPN = "O" AND PTEMPVALN = "XOXOOXXEO" THEN  HVV = HVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OXOXXOOEX" THEN  HVV = HVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XOXOOXXEO" THEN  HVV = HVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OXOXXOOEX" THEN  HVV = HVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XOEOOXXEO" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OXEXXOOEX" THEN  HVV = HVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEOOXXEO" THEN  BVV = BVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEXXOOEX" THEN  BVV = BVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEOOXXEO" THEN  BVV = BVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEXXOOEX" THEN  BVV = BVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEOOEXEO" THEN  BVV = BVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEXXEOEX" THEN  BVV = BVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOEXEO" THEN  DVV = DVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXEOEX" THEN  DVV = DVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOEXEO" THEN  DVV = DVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXEOEX" THEN  DVV = DVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEXEO" THEN  DVV = DVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEOEX" THEN  DVV = DVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEXEO" THEN  EVV = EVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEOEX" THEN  EVV = EVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEXEO" THEN  EVV = EVV +  3 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEOEX" THEN  EVV = EVV +  3 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEO" THEN  EVV = EVV +  2 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEX" THEN  EVV = EVV +  2 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  IVV = IVV +  1 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  IVV = IVV +  1 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-026 
IF MOVTYPN = "X" AND PTEMPVALN = "EOOEXOXXE" THEN  IVV = IVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EXXEOXOOE" THEN  IVV = IVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EOOEXOXXE" THEN  IVV = IVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EXXEOXOOE" THEN  IVV = IVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXOXXE" THEN  IVV = IVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOXOOE" THEN  IVV = IVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXOEXE" THEN  GVV = GVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOXEOE" THEN  GVV = GVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXOEXE" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOXEOE" THEN  GVV = GVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXEEXE" THEN  GVV = GVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOEEOE" THEN  GVV = GVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXEEEE" THEN  HVV = HVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOEEEE" THEN  HVV = HVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXEEEE" THEN  HVV = HVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOEEEE" THEN  HVV = HVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  HVV = HVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  HVV = HVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-027 
IF MOVTYPN = "O" AND PTEMPVALN = "XOOEXOEXE" THEN  IVV = IVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OXXEOXEOE" THEN  IVV = IVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XOOEXOEXE" THEN  IVV = IVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OXXEOXEOE" THEN  IVV = IVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EOOEXOEXE" THEN  IVV = IVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EXXEOXEOE" THEN  IVV = IVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXOEXE" THEN  CVV = CVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOXEOE" THEN  CVV = CVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXOEXE" THEN  CVV = CVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOXEOE" THEN  CVV = CVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXOEEE" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOXEEE" THEN  CVV = CVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXEEEE" THEN  FVV = FVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOEEEE" THEN  FVV = FVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXEEEE" THEN  FVV = FVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOEEEE" THEN  FVV = FVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEEEEEE" THEN  FVV = FVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEEEEEE" THEN  FVV = FVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  BVV = BVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  BVV = BVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-028 
IF MOVTYPN = "X" AND PTEMPVALN = "OEOEXOXEX" THEN  HVV = HVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "XEXEOXOEO" THEN  HVV = HVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "OEOEXOXEX" THEN  HVV = HVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "XEXEOXOEO" THEN  HVV = HVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXOXEX" THEN  HVV = HVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOXOEO" THEN  HVV = HVV +  11 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEXOEEX" THEN  GVV = GVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEOXEEO" THEN  GVV = GVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "OEEEXOEEX" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "XEEEOXEEO" THEN  GVV = GVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXOEEX" THEN  GVV = GVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOXEEO" THEN  GVV = GVV +  8 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXOEEE" THEN  IVV = IVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOXEEE" THEN  IVV = IVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXOEEE" THEN  IVV = IVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOXEEE" THEN  IVV = IVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  IVV = IVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  IVV = IVV +  5 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-029 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEOOEXX" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEXXEOO" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEOOEXX" THEN  DVV = DVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEXXEOO" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEOOEEX" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEXXEEO" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEOEEEX" THEN  FVV = FVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEXEEEO" THEN  FVV = FVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEOEEEX" THEN  FVV = FVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEXEEEO" THEN  FVV = FVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "OEEEOEEEX" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "XEEEXEEEO" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  AVV = AVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  AVV = AVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  AVV = AVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  AVV = AVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  AVV = AVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  AVV = AVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-030 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEOEXOX" THEN  BVV = BVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEXEOXO" THEN  BVV = BVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXOX" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOXO" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEXOX" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEOXO" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXEX" THEN  HVV = HVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOEO" THEN  HVV = HVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  HVV = HVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  HVV = HVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  HVV = HVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  HVV = HVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEX" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEO" THEN  EVV = EVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-031 
REM THE LAST GAME DRAWN! SO FOR THE ABOVE GAME (X) PLAYED A RANDOM 1st MOVE.
IF MOVTYPN = "O" AND PTEMPVALN = "XEOEOEXOX" THEN  BVV = BVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "OEXEXEOXO" THEN  BVV = BVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "XEOEOEXOX" THEN  BVV = BVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "OEXEXEOXO" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEOEXOX" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEXEOXO" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEOEXEX" THEN  HVV = HVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEXEOEO" THEN  HVV = HVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEOEXEX" THEN  HVV = HVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEXEOEO" THEN  HVV = HVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEOEEEX" THEN  HVV = HVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEXEEEO" THEN  HVV = HVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  CVV = CVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  CVV = CVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  CVV = CVV +  6 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  CVV = CVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  CVV = CVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  CVV = CVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-032 
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEOEXOX" THEN  BVV = BVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEXEOXO" THEN  BVV = BVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXOX" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOXO" THEN  BVV = BVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEXOX" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEOXO" THEN  BVV = BVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXEX" THEN  HVV = HVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOEO" THEN  HVV = HVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  HVV = HVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  HVV = HVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  HVV = HVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  HVV = HVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEX" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEO" THEN  EVV = EVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-033 
REM THE LAST GAME DRAWN! SO FOR THE ABOVE GAME (X) PLAYED A RANDOM 1st MOVE.
IF MOVTYPN = "O" AND PTEMPVALN = "EEXEOOEEX" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EEOEXXEEO" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EEXEOOEEX" THEN  DVV = DVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "EEOEXXEEO" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOOEEX" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXXEEO" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  FVV = FVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  FVV = FVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  FVV = FVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  FVV = FVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-034 
IF MOVTYPN = "O" AND PTEMPVALN = "EXXEOOXOX" THEN  DVV = DVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EOOEXXOXO" THEN  DVV = DVV +  13 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOOXOX" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXXOXO" THEN  DVV = DVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EXEEOOXOX" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EOEEXXOXO" THEN  DVV = DVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EXEEOEXOX" THEN  FVV = FVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EOEEXEOXO" THEN  FVV = FVV +  10 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXOX" THEN  FVV = FVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOXO" THEN  FVV = FVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEXOX" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEOXO" THEN  FVV = FVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEXEX" THEN  HVV = HVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEOEO" THEN  HVV = HVV +  7 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  HVV = HVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  HVV = HVV +  6 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  HVV = HVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  HVV = HVV +  5 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEX" THEN  EVV = EVV +  4 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEO" THEN  EVV = EVV +  4 
REM --------------Last-Complete-Game-Learnt-Above--(X)-Goes-1st-Game-035 
REM THE LAST GAME DRAWN! SO FOR THE ABOVE GAME (X) PLAYED A RANDOM 1st MOVE.
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOXOEX" THEN  CVV = CVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXOXEO" THEN  CVV = CVV +  13 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOXOEX" THEN  CVV = CVV +  12 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXOXEO" THEN  CVV = CVV +  12 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEOEX" THEN  CVV = CVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEXEO" THEN  CVV = CVV +  11 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEOEEEX" THEN  GVV = GVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEXEEEO" THEN  GVV = GVV +  10 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEX" THEN  GVV = GVV +  9 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEO" THEN  GVV = GVV +  9 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEOEEEE" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEXEEEE" THEN  GVV = GVV +  8 
IF MOVTYPN = "O" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
IF MOVTYPN = "X" AND PTEMPVALN = "EEEEEEEEE" THEN  EVV = EVV +  7 
REM --------------Last-Complete-Game-Learnt-Above--(O)-Goes-1st-Game-036 

END SUB
Reply
#15
Anthony,

It is much tougher, but I was still able to beat it. It beat me one game, we tied one game, and I beat it one game.

I love it!


Walter Whitman
The Joyful Programmer
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#16
OH! Walter if only I played another (36) Games against it before uploading the Version Sad then It would of had an Extra .1% of Knowledge! Big Grin 




Anthony.
Reply