2 ms·
http://harddrop.com/wiki/Tetris_(Game_Boy)#Randomizer http://harddrop.com/wiki/Tetris_(Game_Boy)#Randomizer
by pixelbath 7y ago
http://harddrop.com/wiki/Tetris_(Game_Boy)#Randomizer http://harddrop.com/wiki/Tetris_(Game_Boy)#Randomizer
- Sniffnoy 7y agoThanks! To repeat it here: we assign each piece a piece a vector of 3 bits; thinking of these vectors as numbers from 0 to 7 (or rather 0 to 6, since 111 is unused), the pieces go in the order (L, J, I, O, Z, S, T). Note that this assignment is not left-right symmetric; there's no particular relation between a piece and its mirror image. Like, L is 000, but J is 001; and Z is 100, but S is 101. That seems like kind of a dumb mistake -- it would've been easy enough to maintain symmetry. (As just one example among the 24 possible ways (assuming 111 must be kept unused), one could have used instead (O,J,I,Z,L,T,S).) Anyway, each turn you pick one of these at random, and you look at the last two pieces; let's call these previous_1 and previous_2. If -- considering pieces as their sets of 1-bits -- we have both that previous_1 is a subset of previous_2, and that the picked piece is a subset of previous_2 -- we reroll. After the third try we just take the piece no matter what. Note that this means that there are some weird interactions between the previous two pieces. Like, if previous_1 is not a subset of previous_2, then we won't reroll no matter what piece we picked, so the new piece will be totally random. But if it is, then we may or may not reroll. Definitely pretty weird. Have to wonder how on earth this was thought up...