Tetris implementation in pure javascript