Live data from Hacker News

2048 Solver

github.com

1–10 of 41 posts

Re: 2048 Solver

#2
I would be curious to see a more detailed writeup of this, as I haven't understood how this algorithm is applied.

Question that I didn't understand the answer to:

> There are implemented 3 cost functions:

> 1. sum of all tiles in the playing field

is this a useful cost function at all? Surely the sum of the tiles is not affected by strategy played, only by whether a 2 or 4 was randomly received.

> 2. number of all unassigned tiles in the playing field

> 3. average value of an occupied tile

Then, for similar reason, I would be surprised if these were not equivalent.

Re: 2048 Solver

#5
post #4

Any remarks on average number of rounds to get to 2048?

From the op: "But level=2 is enough to win 100% of all games!"

So I think it can win all games?

Re: 2048 Solver

#6
Interesting work. I'd be curious to see this algorithm applied to the original game. Since this is a re-implementation of the game in Java, it may be solving a completely different game.

Re: 2048 Solver

#7
I could be wrong here, but from my reading of the source this doesn't look like an A* search algorithm. For starters, the search space is nondeterministic, and since you can only explore in one direction, you're not really performing a search space exploration as much as choosing a direction and going with it.

Secondly, the implementation doesn't perform the combination of current state score and proposed state score that lies at the heart of the A* algorithm. Instead it takes the current state for granted (which, again, it must given the inability to backtrack) and chooses the available move with the largest score.

Thirdly, and I'm reaching a little here, I can't find any place where any heuristic is used to optimize search performance by pruning the search tree. The search space is brute forced on each iteration, and the entire tree is scored.

At the expense of seeming pedantic I suggest this is a greedy play algorithm rather than A*. You can be even more precise and call it a single-ply minimax.

Now that that's out of the way, I should temper my criticism with the fact that this implementation works. It's not algorithmically complicated because it doesn't have to be. It doesn't use any of the typical performance tricks because it doesn't need to. What it lacks in sophistication it makes up in "good enough."

Re: 2048 Solver

#8
post #2

I would be curious to see a more detailed writeup of this, as I haven't understood how this algorithm is applied. Question that I didn't understand the answer to: > There are implemented 3 cost functions: > 1. sum of all tiles in the playing field is this a useful cost function at all? Surely the sum of the tiles is not affected by strategy played, only by whether a 2 or 4 was randomly received. > 2. number of all un…

You are right, the first cost function doesn't make a lot of sense, but I didn't divide by the number of leafs - so it basically also was based on the number of unassigned tiles.

So in the end you are right these approaches are more or less the same.

Re: 2048 Solver

#9
Thanks for sharing this. I may have missed this answer between all of the threads related to 2048, but has anyone found if there is a limit for the 4x4 tile size?
Post reply on HN