Cool! I made a demo playable in the browser: https://repl.it/@amasad/tinytetris
Or run it directly here: https://tinytetris.amasad.repl.run/
Or run it directly here: https://tinytetris.amasad.repl.run/
I needed to allow requests to five 3rd party domains for this tiny Tetris to load (uMatrix)
And yes, the starting position of new pieces looks random.