Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
Is there any optimal algorithm for the game 2048? - bug-code.com Q&A

Is there any optimal algorithm for the game 2048?

0 like 0 dislike
40 views
asked by (4.3k points) | 40 views

1 Answer

0 like 0 dislike

There is still not a flawless method to complete 2048, but there is an AI that seems to be really near the ideal.

https://github.com/nneonneo/2048-ai

To execute a move, the AI takes 10ms- 00msm it depends on the complexity of the board position. The average rate is 5-10 moves per second. Also, it can make more than 20 moves per second if there is the search depth limit of 6 moves.

 

It uses such proportions for each title:

2048: 100%
4096: 100%
8192: 100%
16384: 94%
32768: 36%

The min score is 124024, the max is 794076, the median is 387222. AI is never failed the 2048 title obtaining and the 8192 tile is achieved at least once in every run.

Here is a shot of the best performance:

PIC

It encodes the 16 entries as a single 64-bit integer (with 4-bit chunks titles). The entire board passes around in a single machine register on a 64-bit machine. To extract individual rows and columns bit shift operations is used. Scoring works by table lookup.

 

Due to such board representation, the AI searches a huge number of game states in a short period of time (over 10,000,000 game states per second on one core of my mid-2011 laptop).

The imperfection of the AI is in heuristics, because there are could be better heuristics that are used now.

answered by (8.5k points)
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers

0 comments

12.7k users

24,788 questions
46,220 answers
0 comments
12,685 users