Another partial step on 2048

Building on Some notes on 2048, and Iteration on my 2048 strategy.

This thought is not quite complete, I think.

There’s an abstraction of a row being “rigid” (I might need to find a better name for it): That means that that row is filled with 4 blocks, and no two neighboring blocks in that row are pairs. This means that the row will not move in response to any lateral motion.

You want it to be the case that either the top row, or the second to top row, is rigid before you use lateral motion to compress blocks in either of those rows. This prevents a situation where you have to move laterally, when there’s fewer than 4 blocks in the top row, which risks having the new (low-numbered) block appearing on the wrong side of your carefully maintained low-to-high gradient across the top row.

If you’re compressing the second to top row, the top row stays rigid. And if you’re compressing the top row, you can rest assured that you can fill it from the second to top row, you won’t run into the problem of being trapped without a “up” move, and forced to move in the lateral direction counter to the size-gradient you’re constructing.

So as a heuristic, you want to get to a place where one of those rows is rigid, before compressing them.

This means…

  • If the second to top row is rigid and the top row is full, but not rigid, compress the top row all the way, and then use “up” to fill it in from the second to top row.
  • If the top row is rigid, but not the second to top row, use lateral motions to fill out the second-top row to rigidity, before doing any lateral compressions in the top row or vertical compressions into the top row.
    • That upward motion of vertical compression into the top row, might disrupt the rigidity of the second-to-top row. If so, you want to restore it,
  • If neither row is rigid, but they’re both full, press up, until you get one to rigidity.

It seems like the main failure mode of this strategy is it tends to lead to the bottom part of the board getting kind of bloated, and if you’re not careful you’ll run out of space.