This is my 2048 AI from 2020, ported from Python.
The best way to play 2048 is to keep the biggest tile in a corner and line the rest up behind it in decreasing order, back and forth like a snake. Then every tile sits next to the one it merges into next.
So the bot scores a board by how snake-like it is: walk a snake path through the board, halving the running total at each cell and adding that cell's tile, so the tiles near the end of the path count the most. It tries the snake in all 8 orientations and keeps the best.
Then it's minimax with that score: before each move it tries every sequence of the next six moves, and makes the first move of the sequence that ends on the best-scoring board.
The Python is at quasarbright/2048.