Comparison of the MiniMax and AlphaBeta Algorithms:
The integer variable m is used in the computer_move() and the MiniMax() algorithm to keep track of how many "best" moves are recorded using straight minimax (version 7) and minimax with alpha-beta pruning (version 8). Each time a new "best" move is found new values are recorded for bestc and bestr. Here are the values of m for the minimax and alphabeta algorithms under four test conditions: MINIMAX: Computer First Move: 288,320 Human First Move: Left Upper (human): 31,481 Center (human): 28,859 Bottom Middle (human): 33,475 ALPHABETA: Computer First Move: 7,853 Human First Move: Left Upper (human): 944 Center (human): 1,058 Bottom Middle (human): 2,240 The values for m indicate that the alpha-beta enhanced minimax algorithm was quite a bit more efficient than just plain minimax. It should be noted that there are 362,880 possible first moves and 45,360 possible second moves in a game of tic tac toe. ************************************************************** The minimax algorithm should always play a perfect game. I was not able to defeat it. The only difference I noticed between the minimax and the alphabeta enhanced version was that the alphabeta enhanced version was slightly faster on the first move.