Answers.Body: <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.sstatic.net/SMUmz.png" rel="noreferrer"><img src="https://i.sstatic.net/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.sstatic.net/5K55J.png" rel="noreferrer"><img src="https://i.sstatic.net/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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-20T13:27:44.927Z
Answers.Text: 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?
Answers.UserDisplayName: Fate
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-20T14:38:15.637Z
Answers.Text: @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.
Answers.UserDisplayName: GloriaVictis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-20T20:48:13.273Z
Answers.Text: 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.
Answers.UserDisplayName: Fate
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-20T21:07:44.783Z
Answers.Text: @Petrosian 0.349341653669 and added to answer.
Answers.UserDisplayName: GloriaVictis
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-02T09:14:05.613Z
Answers.Text: GloriaVictis might you be able to do this for [pawns at the start of the endgame](https://chess.stackexchange.com/questions/37436/on-average-how-many-pawns-are-there-at-the-start-of-the-endgame)?
Answers.UserDisplayName: BCLC
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-20T11:24:29.323Z
Answers.LastActivityDate: 2015-12-20T21:09:09.140Z
Answers.LastEditDate: 2015-12-20T21:09:09.140Z
Answers.UserDisplayName: GloriaVictis
Body: <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>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-20T13:55:19.663Z
Comments.Text: This looks like a copy-paste of a homework assignment.
Comments.UserDisplayName: 11684
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-20T14:58:28.137Z
Comments.Text: @11684 Given the poster's history here, I really doubt that it's a homework assignment.
Comments.UserDisplayName: dfan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-31T21:00:35.453Z
Comments.Text: Do you include games where somebody resigned or only games that are played to the end?
Comments.UserDisplayName: edwina oliver
Tags: <statistics><programming><pieces><mathematics>
Title: What's the average piece density?
ThreadText: # What's the average piece density?
  
  (Asked by: username_0 on 2015-12-20)
  
  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.
  
  **Tags:** statistics, programming, pieces, mathematics
  
  > **Comments:**
  > **username_1**: This looks like a copy-paste of a homework assignment.  
  > **username_2**: @username_1 Given the poster's history here, I really doubt that it's a homework assignment.  
  > **username_3**: Do you include games where somebody resigned or only games that are played to the end?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_4 on 2015-12-20. Score: 8 | Accepted answer
  
  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](http://chessproblem.my-free-games.com/chess/games/Download-PGN.php) page (this should fit OPs requirements). The results:[![Average piece densities by halfmove](https://i.sstatic.net/SMUmz.png)](https://i.sstatic.net/SMUmz.png)
  
  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](http://chess-db.com/public/downloads/gamesfordownload.jsp) (although most likely includes games with non-classical time control).
  [![Average piece densities by halfmove](https://i.sstatic.net/5K55J.png)](https://i.sstatic.net/5K55J.png)
  
  I am making the script [available](https://gist.github.com/username_4/bc792523fc8145092c25), so that you can run it on PGN of your choice. It depends on the [python pgn parsing package](https://pypi.python.org/pypi/pgnparser/1.0).
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_4**: @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.  
  > **username_0**: 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.  
  > **username_4**: @Petrosian 0.349341653669 and added to answer.  
  > **username_5**: username_4 might you be able to do this for [pawns at the start of the endgame](https://chess.stackexchange.com/questions/37436/on-average-how-many-pawns-are-there-at-the-start-of-the-endgame)?  
  
  ---
  
  