Javascript implementation of Tetris