We have a square N * N matrix of integers populated with random values between 1 and vMax.
If 2 adjacent values in a row or in a column (Von Neumann neighborhood) are equal, then they are cleared to zero.
We have a predefined number of M moves to do. Each move changes the value of a single cell to some other value in the range.
The goal is to play all moves so that as much as possible cells are cleared for a fixed time.
Each move is a transaction. If 3 cells in a row become with equal values, then the last move should change the middle cell in order all 3 cells to be cleared. The same is valid for the corner of the 3 cell L shape, and for the center of the 5 cell + shape.
N is about 1000, vMax is about 5000, M is about 100, time limit is about 3 seconds computer execution time.
It is supposed that the time is insufficient to find the best possible solution so the target is finding some "good" solution.
Does this problem have its own name? Are there known applicable theories? How an efficient computer algorithm will look like?