This article will teach you about the minimax algorithm and alpha-beta pruning, from a beginner's perspective.
If there is a 50% chance something will go wrong, then 9 times out of 10 it will.