What is a perfect player?
A game where you win or you draw but never lose.
If two perfect players play, it should always be a draw
Calculate all possible moves and calculate the best move
A way to be a perfect player is to calculate all possible moves and give a score to each of those moves. A way to predict the future.
How can we explain how we score
Me as the current player wins 🙂 (yup I’m the best) I get 10 points
I lost.. 😦 I lose 10 points and the the 10 poiunts goes to the other player.
It was a draw. We both get …….no points.
MINImising & MAXimising moves
The current player always plays to maximise their points by playing to win, and in turn minimise the opponents score.
Minimax scores a game once the game is over, if not it continues recursively going through all possible generated game states.
Possible games are generated by simulating a move, always first with the current player, then finding the next available move and switching the current player and repeat.
Once that’s done, a collection containing all the scores and their associated moves. For each of the states, the minimax score is added to the scores list.
If it’s player “X” then the maximum score from the list is return, if the player is “O” than the minimum score is return from the list.