So this week, I found out that I had done my minimax function completely wrong the day before it was due. My understanding of minimax was wrong the entire time.
I thought Minimax was a type of strategy where the computer would calculate every possible game state that can result from a move and then return the chance of winning for that move.
So for example, let's say that the computer can make 3 possible moves. Minimax would go through each of these moves and find every possible final game state. It would then find the "average" of all these final states and rate each of these three moves based on the percentage of win states to total states.
So minimax might end up generating something like this:
Move 1: (40% win chance)
Move 2: (70% win chance)
Move 3: (80% win chance)
Based upon my minimax, the computer would choose move 3.
The fundamental error here is that I assume that my computer is going up against an imperfect opponent. A real minimax is supposed to assume that the computer is facing a flawless opponent.
Knowing that I had such a huge problem in my program, I had to pull an all nighter to finish minimax.
By a miracle, it turns out that all the information I ever needed on minimax was on wikipedia. There was nothing to stress over the entire time.
http://en.wikipedia.org/wiki/Minimax
There was more than enough information for Minimax, Not only that, there was even pseudocode for minimax. With this much useful info, I finished minimax in 2 hours.
In addition to finishing minimax I also reviewed a few of the past labs for recursion. I found some of the recursion problems, (especially for binary lists) to be very hard. Not so difficult that I couldn't solve them with enough time but difficult enough that they can stump me for a while. I am going to have to practice these problems alot if I want to succeed on the test.
No comments:
Post a Comment