modified tetris algorithm