# What's the average piece density?

In a position, the piece density is equal to the total number of pieces on the board (Whites pieces + Black pieces) divided by the total number of squares (64).

At the beginning of every game, the piece density is equal to 32/64=0.5, and at any point of the game the piece density is always smaller or equal to 0.5

The piece density can only decrease during a game. It decreases by 1/64=0.015625 at each capture.

I would like to know what's the average piece density.

I'd need a decent precision on the result, so you can't just use a small sample of 5 games. You'll need to take a large sample of at least 500 games, the more the better.

It should be fairly easy. To make the program that will calculate this average piece density, use the facts that at the beginning of each game the piece density is equal to 0.5, then at each capture it decreases by 0.015625, and the program will be able to detect each capture easily since captures are indicated by a "x" symbol in the PGN. So the program won't have to represent every positions of every games, it will be able to quickly calculate the average piece density just by scanning the PGN.

But take only OTB games, played at a classical (long) time control of at least 2 hours per player, and where both players were at least 2000 Elo. No correspondence games, no engines games, no internet games, no rapid games, no blitz games.

• This looks like a copy-paste of a homework assignment. Dec 20, 2015 at 13:55
• @11684 Given the poster's history here, I really doubt that it's a homework assignment.
– dfan
Dec 20, 2015 at 14:58
• Do you include games where somebody resigned or only games that are played to the end? Jan 31, 2020 at 21:00

First of all, I think this is a bad question (similar to StackOverflow "Give me the code" questions).

That being said, the subject itself seemed interesting, so I threw a quick and dirty (and inefficient - feel free to optimise) script together to do this. I ran it on PGN file of world championship games between 1895 and 1985 from this page (this should fit OPs requirements). The results:

The overall average value for the data points in the World Championships PGN is roughly 0.35 (0.349341653669).

EDIT: Results on much bigger PGN sample (~275.000 games) - chess db grandmaster collection (although most likely includes games with non-classical time control).

I am making the script available, so that you can run it on PGN of your choice. It depends on the python pgn parsing package.

• Great work! Though I didn't asked for the code/script and I don't understand it much anyway (the only programming language I know is C# and I just know the basics...), but nice of you to have included it. Before I accept your answer, what did you obtain for the value of the average piece density?
– Fate
Dec 20, 2015 at 13:27
• @Petrosian The average of all data points (i.e. piece densities for every halfmove, for every game) in the World Championships PGN is roughly 0.35. Dec 20, 2015 at 14:38
• I think you should add the value of the average piece density in your answer, since this is the true answer to the question. But could you please give 3 or 4 significant figures instead of just 2? Because "roughly 0.35" is not very precise.
– Fate
Dec 20, 2015 at 20:48
• @Petrosian 0.349341653669 and added to answer. Dec 20, 2015 at 21:07