Tetris problem. An approach to solve it

Each time when someone refreshes the page, he (she) generates a new version of the world.
The tetris agent looks at that world and tries to find the optimal solution for every certain case.