February 12th, 2019
This morning I told my mentor that minimax would be listed on my tombstone as the cause of my death. Yes, that's where I'm at right now. I don't expect any updates on that for a long while. That attitude may be part of why I'm struggling with the concepts of recursion and minimax, but maybe being honest about my feelings will eventually help me out of this rut.
I'm working on my tic tac toe game in Ruby. I'm working on a feature that will allow a user to play against a computer. Given the opportunity to win or tie the game, the computer will win or tie the game. Essentially I have to build an algorithm that will make the computer player unbeatable. There are several ways to address this problem, but typically this is done by writing a minimax algorithm. This algorithm will consider all possible moves at any given state of the board, evaluate each move, and return the best move that will result in a win or a draw. At least, this is my understanding of the algorithm up to this point. My other basic understanding is that this algorithm is recursive, meaning that it will invoke itself (hopefully until a base case is reached). One pain point for me is the fact that there are thousands of possible game states. The algorithm will run through numerous game states as it evaluates the result of one move. How can I avoid an endless loop that results in my computer yelling at me over disk space?
My other pain point is the inability to break this algorithm down into chunks. I prefer to break things down into smaller pieces. It doesn't seem as though I'm going to be able to break down this algorithm. It's all or nothing with minimax. This is a bothersome attribute. However, starting out with near terminal game states will help me determine if my algorithm is correctly coded.
So I have a few main questions. I think once these are answered, I'll be closer to building a successful algorithm.