Have you ever wondered how AIs for two player games like chess, checkers, tic tac toe, and even 2048 work? Well, it turns out that they all use pretty much the same method! In this article, we introduce the Minimax algorithm, a method for programming AIs that can play a huge variety of two-player games, including all of the games mentioned above, and more!

Let’s start off with an example. Say you are playing a game where you take cookies from a cookie jar, and you want to get the most number of cookies possible. Now say that you are at a point where you can make one of two moves: take 5 cookies, which then your opponent has the option to take 3, 6, or 9 cookies; or take 10 cookies, which then your opponent has the option to take 1, 10 or 100 cookies.

In this case, knowing nothing else, you would probably take the latter choice. Why? Because we can simplify the situation by assuming what the opponent will do: by maxing the latter choices, we can simplify the situation to: if take 5 cookies, then the opponent will take 9; if we take 10, then the opponent will take 100. Then, we simply take the best of the two choices (

**the choice that minimizes their cookies minus our cookies, hence the name minimax**).That is the intuition behind the

**Minimax algorithm**. By expanding upon this idea, it is possible to create extremely sophisticated and powerful AIs. For example, the famous chess playing robot**Deep Blue**was programmed using these techniques!That’s all for this week. See you guys later!

— John Ma

Advertisements
(function(g,$){if("undefined"!=typeof g.__ATA){
g.__ATA.initAd({collapseEmpty:'after', sectionId:26942, width:300, height:250});
g.__ATA.initAd({collapseEmpty:'after', sectionId:114160, width:300, height:250});
}})(window,jQuery);
var o = document.getElementById('crt-1497968027');
if ("undefined"!=typeof Criteo) {
var p = o.parentNode;
p.style.setProperty('display', 'inline-block', 'important');
o.style.setProperty('display', 'block', 'important');
Criteo.DisplayAcceptableAdIfAdblocked({zoneid:388248,containerid:"crt-1497968027",collapseContainerIfNotAdblocked:true,"callifnotadblocked": function () {var o = document.getElementById('crt-1497968027'); o.style.setProperty('display','none','important');o.style.setProperty('visbility','hidden','important'); } });
} else {
o.style.setProperty('display', 'none', 'important');
o.style.setProperty('visibility', 'hidden', 'important');
}
var o = document.getElementById('crt-430366286');
if ("undefined"!=typeof Criteo) {
var p = o.parentNode;
p.style.setProperty('display', 'inline-block', 'important');
o.style.setProperty('display', 'block', 'important');
Criteo.DisplayAcceptableAdIfAdblocked({zoneid:837497,containerid:"crt-430366286",collapseContainerIfNotAdblocked:true,"callifnotadblocked": function () {var o = document.getElementById('crt-430366286'); o.style.setProperty('display','none','important');o.style.setProperty('visbility','hidden','important'); } });
} else {
o.style.setProperty('display', 'none', 'important');
o.style.setProperty('visibility', 'hidden', 'important');
}