how doe piece selection work? isnt it random?
I'm Bill, the author. I think the game randomness is a function of the inputs the game has received. I ran into some things that were interesting w.r.t. randomness. As I mentioned we have this thing called a "tactic" that prepares batches of inputs for what we are testing; in this case, key presses. I made the tactic assume it had a piece ready to drop, and then to randomly choose the piece orientation and the column, using randomness from our fuzzer, and then press DOWN a bunch of times. Later I added a small random chance that the piece would shift over to the left or right on the way down. This greatly increased the speed at which we progressed through levels, which surprised me. I have not run a thorough test of this, but my theory is that the benefit of the piece shift was not in allowing the piece to fit into more spaces, but was more because it tweaked the game RNG and gave the strategy more variations to choose from. Watching the runs I don't see a lot of times when a piece shifts at the last instant to "tuck" into a spot, but I do see pieces shift over on their way down. To a human, starting in column 4 and during the drop shifting to column 3 would seem equivalent to just starting in column 3 in the first place, but it is possible this gives two different RNG states in the game and one turns out being better than the other.
Seems to be influenced by the pieces on the board. Bill talks about it a little in the article. You do seem to get more | shaped pieces when you leave those spaces open on the board.
The best versions of Tetris are random in sets of 7. There's a "bag" of all 7 shapes and the next piece is picked from that bag until the bag is empty and then it refills.
You're talking about piece, right? I know that it's actually determined by the execution state per frame and the button inputs [1]. I looked into Tetris AI before because I found it fascinating, but I might be mistaken.
[1]https://tetrissuomi.wordpress.com/wp-content/uploads/2020/04...
NES Tetris have memory système that tries to repetition. As per Tetris wiki:
> The randomizer features a slight protection against direct repetition. The first roll generates a value 0-7 and will accept and deal on any value other than the previous piece dealt or the dummy value of 7. The piece history is initially empty. If the first roll fails, it progresses to a second roll that generates a value 0-6 and deals that piece.
Later games would evolve into a more ambitious history system like in Tetris the Grand Master, or a "bag" (Fisher Yates) system.
From a game design point of view, this avoids repetition in the distribution which generally suuuucks while playing.