I once wrote a Tetris AI that played Tetris quite well. The algorithm I used (described in this paper) is a two-step process.