@boku_research(boku@openIllumi.com)

Break Through the Wall of AI Development for High Scores in “2048”! The Secret to Dramatically Boosting Your Score with the Optimal Algorithm, “Expectimax”

  • Python
  • AI
  • algorithm
  • game development
  • machine learning
0
TAG34@@
Posted on 2026-11-10

In AI development for the 2048 game, the greedy method reaches a plateau at around 4,000 points on average, exposing the problem of local optima, where the best immediate move leads to a future dead end. The root cause is that it does not account for uncertainty (the random appearance of tiles) or calculate future expected values.

What Happened (Symptoms and Causes)

  • With the greedy method (a strategy that maximizes the number of merges), once the board becomes complex, it becomes impossible to predict the future, resulting in a game over.
  • Because the player's move (Max node) is followed by the system's random tile placement (Chance node), a simple minimax search cannot handle it.
  • Because the evaluation function depends only on the number of empty cells and merges, it does not consider tile monotonicity or smoothness.

How It Was Solved (Basic Steps and Commands)

Introduced Expectimax search, the standard solution for games containing probabilistic elements, which calculates the expected value of board states several moves ahead and selects the move that maximizes it.

# Examples of Heuristics Emphasized by High-Performance AI # 1. Monotonicity: Whether tiles are arranged in one direction from an edge toward a corner # 2. Smoothness: Minimizing the sum of the differences in values between adjacent tiles # 3. Number of empty cells: A penalty for preventing game over

👉 To see the specific game-tree structure of Expectimax search and methods for optimizing search speed using bit operations, check this out.
Break Through the Wall of AI Development for High Scores in “2048”! The Secret to Dramatically Boosting Your Score with the Optimal Algorithm, “Expectimax”

Results After the Fix (Before / After)

By combining Expectimax search with sophisticated heuristics, it becomes possible to consistently achieve scores in the tens of thousands and, at times, aim for hundreds of thousands. Also, when designing an evaluation function, defining not only “what is good” but also “what is acceptable” is an important best practice for avoiding a rigid AI.

🚀 For the complete code and detailed environment-specific instructions, see here

You can find a full explanation of alternative approaches to Monte Carlo tree search (MCTS) and automatic heuristic tuning using meta-optimization algorithms.

👉 Break through the wall of developing AI that achieves high scores in “2048”! The secret to dramatically boosting your score with the optimal algorithm, “Expectimax”

Note: This technical note is an excerpt of the key points from an article written for the technical blog CodeArchPedia.com.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
Sign upLogin