Optimizing resource management game (similar to Farmville)
In general, you cannot hope for a polytime solution to all such games.  For many such games, the problem of playing them optimally is NP-hard.

For instance, Minesweeper (on a $n\times n$ grid) is NP-hard, and thus does not have a polytime algorithm to solve it (unless $P=NP$, which most consider unlikely).  The same is true for Sudoku (on a $n^2 \times n^2$ grid) and Tetris.  Optimal play for chess, checkers, Go, and Scrabble (on a $n \times n$ grid) is either EXPTIME-complete or PSPACE-complete (depending upon whether you put a bound on the number of moves that a player can make), so they too are very unlikely to have any polytime algorithm to play them optimally (unless the polytime hierarchy collapses or something equally surprising).

In fact, I've seen some folks suggest that there's a strong connection here: the best games tend to be ones where finding the optimal solution is asymptotically hard.  If finding the optimal solution was too easy, the argument goes, the game wouldn't be fun for humans.  Obviously, this is not a rigorous argument and it is easy to come up with counterexamples, but I think there might be something to it.

There's lots more written on this sort of topic.  For a entry point and overview, see, e.g., the following:


http://for.mat.bham.ac.uk/R.W.Kaye/minesw/ordmsw.htm
https://en.wikipedia.org/wiki/Game_complexity
https://www.ics.uci.edu/~eppstein/cgt/hard.html