Minimax is an algorithm designated for playing adversarial games, that is games that involve an adversary. In this article, we’ll see how we can apply the minimax algorithm to solve the 2048 game. This is the first article from a 3-part sequence. This one will consist of planning our game-playing program at a conceptual level, and in the next 2 articles, we’ll see the actual Python implementation.

Here I assume you already know how the minimax algorithm works in general and only focus on how to apply it to the 2048 game. So, if you don’t already know about the minimax algorithm, take a look at:


The main 4 things that we need to think of when applying minimax to 2048, and really not only to 2048 but to any other game, are as follows:

1. How we can think of 2048 as a 2-player game? Who is Max? Who is Min?

2. How do we decide when a game state is terminal?

3. How do we evaluate the score/utility of a game state?

4. How do we determine the children of a game state?

#algorithms #programming #algorithmic-thinking #artificial-intelligence #game-theory

How to apply Minimax to 2048
6.05 GEEK