# NES Statistics

Thread in 'Research & Development' started by tjzosli, 1 May 2020.

1. ### tjzosli

I made a spreadsheet covering every thing I could find about NES Tetris statistics. It has everything from points to your score before the kill screen based on your tetris %.

Any suggestions of what to change/add or questions?

I'm also not the best with Google sheets so if you have any suggestions for formatting that it would be great.

Last edited: 1 May 2020
2. ### PMYA

The pieces in a row part is incorrect, due to the way the sequence works, you can not get more than 4 I pieces in a row, for example. I believe squares are the only piece you can get an infinite amount of.

3. ### tjzosli

What part of the randomizer is that? I thought that it was simply less likely to get many in a row because of the way the randomizer works. For the formula, I had =n*r^(l-1), where n is the chance of getting the particular piece when it is when the piece before is not that piece, r is the chance of getting that piece as a repeat piece, and l is the length of the string. How would I change the formula to take that fact into account?

4. ### PMYA

The relevant info is in the "experimentation with piece count" tab. Essentially each time a piece is called for, 4 pieces can be chosen. The piece table is chosen by the total piece count or lines number or something, I don't remember. Basically the way it works out is that certain pieces can only ever be chosen x amount of times, but square has some sort of 0 value that can be chosen at any time so it can show up indefinitely.

This is probably mostly wrong, I don't remember exactly how it was explained to me, but the info is there I believe.

5. ### tjzosli

Thanks, that helps a lot. I'm still working on how that info changes my spreadsheet, but where did find that information? I can't find anything about it picking 4 pieces whenever a piece is called for anywhere else on the internet. All I could find is the part about it picking 0-7 where it repeats if 7 or the last piece is picked. I've also found that some pieces are favored in the second random number in the "picking tetriminos" section of this article https://meatfighter.com/nintendotetrisai/#Picking_Tetriminos, but I didn't see anything about the concept you showed me even in the sections of the source code of the game I could find on the internet. Does the place that you found that have any other information that I could use?

6. ### PMYA

I think it was put together by HydrantDude, he makes romhacks and stuff for nes. I'm not sure if he got the info from elsewhere, if not I assume he figured it out himself.

7. ### Kitaru

It's a property that a handful of us have either discovered independently or shared in conversation. One place it is covered is here: https://tetrisconcept.net/threads/randomizer-theory.512/page-11#post-59775

To summarize the details briefly, the reasons comes down into the kind of Pseudo-Random Number Generator that NES Tetris uses (it's a Linear Feedback Shift Register), the way NES Tetris uses it (the re-roll rule uses sequential random numbers from the LFSR in such a way that the value from roll #1 has can only be followed by two possible values on roll #2), and how the math differs for the first and second rolls (the number of pieces dealt since console power-on is a source of entropy in roll #1, but the piece id of the previous piece is used as a source of entropy in roll #2). So, you get interactions in the math based on the relationship between "how many pieces have been dealt so far" and "what was the previous piece" that affect what results are possible on the re-roll step, which is drives conclusions like "it's possible to get an infinite string of O pieces," "it's only possible to get four I-pieces in a row," and "JTZ pieces are all more likely to follow one another."

8. ### tjzosli

Sorry for taking so long to respond. Thanks for explaining. I think I understand how it works now, but to do math with it I need some specifics. How are the sources of entropy modified to get a piece or piece ID, and how does this all work with the LFSR?

9. ### Arcorann

All the specifics are listed at the article you linked earlier. In particular, what you might have missed is that the LFSR generates one bit at a time and the LFSR is called exactly once in the case of a reroll, which means that while one of the bits is new the rest of the bits are carried over from the previous generated number.

Last edited: 9 Jun 2020