Minimax algorithm - artificial intelligence:
The minimax algorithm is so called because it assumes that you and your opponent are going to act rationally, so that if you will choose moves to try to maximise your final score and your opponent will choose moves to try to minimise your final score.
To demonstrate the minimax algorithm, it is needful to have a game whethere the search tree is fairly small. For that reason, we are going to invent the following very trivial game:
Take a pack of cards and deal properly out four(4) cards face up for this. Two players take it in turn to choose a card each until they have two each. The object is to choose two cards that they add up to an even number. The winner is the one with the largest even number n in the picture cards all count as 10 as show, and the winner scores n. If both players get the same even number, it is a draw, so they both score is seen zero.
Suppose the cards dealt are 3, 5, 7 and 8. We are concerned in which card player one should decide very first, and the mini-max algorithm can be used to decide this for us. To express this, we will draw the entire search tree and put the scores below the final nodes on paths which represent particular games.