user3237: 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.

user3831: 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.

3237: <p>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).</p>

<p>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</p>

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

<p>I would like to know what's the average piece density.</p>

<p>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.</p>

<p>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.</p>

<p>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.</p>
 3831: <p>First of all, I think this is a bad question (similar to StackOverflow "Give me the code" questions).</p>

<p>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 <a href="http://chessproblem.my-free-games.com/chess/games/Download-PGN.php" rel="noreferrer">this</a> page (this should fit OPs requirements). The results:<a href="https://i.stack.imgur.com/SMUmz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SMUmz.png" alt="Average piece densities by halfmove"></a></p>

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

<p><strong>EDIT:</strong>
Results on much bigger PGN sample (~275.000 games) - <a href="http://chess-db.com/public/downloads/gamesfordownload.jsp" rel="noreferrer">chess db grandmaster collection</a> (although most likely includes games with non-classical time control).
<a href="https://i.stack.imgur.com/5K55J.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5K55J.png" alt="Average piece densities by halfmove"></a></p>

<p>I am making the script <a href="https://gist.github.com/GloriaVictis/bc792523fc8145092c25" rel="noreferrer">available</a>, so that you can run it on PGN of your choice. It depends on the <a href="https://pypi.python.org/pypi/pgnparser/1.0" rel="noreferrer">python pgn parsing package</a>.</p>
