user32561: Is there a way to figure out the average number of moves of a game? Looking at games on record, it is 40 or so. OK, but what about in pure chess sense? For instance, I was looking at game in which one player won Queen for Rook in the middle game. After a few moves the weaker side resigned. Fair enough. But playing the game out to the final result took seventy or so more moves! The number of moves on record does not reflect the actual logical number of moves of which a game should consist.

user1947: In a pure sense, you would have to play out (virtually simulate) all possible games and then take the average number of moves across all of them.
You could start with the Shannon Number as an idea of roughly how much computing power you would need (hint: it's more than is available in our universe) but since it's based on estimating the average game length it wouldn't work for determining that length itself without enumerating all of possible games.
What is more interesting is to look at the number of possible moves after each number of plies as well as the number of checkmates (or more generally, any end of the game).   For the first 9 plies one in 6095 games has ended in checkmate, but comparing to 1 in 8628 for the first 8 plies, 1 in 8334 for the first 7 plies, and 1 in 10996 for the first 6 plies (as well as a little common sense) it's obvious that the percentage of checkmates after a given ply, while not always increasing, is tending in that direction.  If you plotted this curve of percentage of games ended by the nth ply you might (assuming the path isn't too chaotic) start to estimate how the curve might continue past the limits of your computations and get a rough guess as to the average length.
Best case with some smoothing you might find some kind of bell-like curve where most games end in the middle, with a few obvious truncation artifacts from things like the 50 move rule preventing a long tail.
You could also try a Monte Carlo simulation of games randomly chosen from legal moves. While most paths on the game tree consist of lots of moves that make no strategic or tactical sense, this might give you a "truer" picture of the actual average length of the whole game tree.  Or if you are only interested in certain types of games you could create games played between computers of various strengths.

user30545: Here are the results based from the games at TC 10minutes + 6s inc. The games are not adjudicated. You can download the games at http://www.fastgm.de/10min.html.
These games have PlyCount tag, we can use this to get the approximate average number of moves on the games. You can use python chess modules to do this.
pgn file: Top10-10min.pgn
average ply: 198
approximate average number of moves: 99

Python code
import chess
import chess.pgn
import statistics


fn = 'Top10-10min.pgn'

data = []

with open(fn, 'r') as f:
    while True:
        game = chess.pgn.read_game(f)
        if game is None:
            break

        plycnt = int(game.headers['PlyCount'])
        data.append(plycnt)


print(f'average ply: {statistics.mean(data)}, approximate average number of moves: {statistics.mean(data)//2}')

Other stats on ply numbers.
file: Top10-10min.pgn
src: http://www.fastgm.de/10min.html

Game Ply Stats
Average: 198.0
Minimum: 25
Maximum: 909
Stdev: 96.0

Average plies by ECO
eco                                       opening  ave_plies
D80                                     Gruenfeld      225.0
E45                                  Nimzo-Indian      222.0
A17                                       English      221.0
E20                                  Nimzo-Indian      218.0
E11      Bogo-Indian defense, Gruenfeld Variation      216.0
E22                                  Nimzo-Indian      215.0
C07                                        French      214.0
D30                       Queen's gambit declined      214.0
B17                                     Caro-Kann      213.0
C70                                     Ruy Lopez      213.0
A11                                       English      211.0
A13                               English Opening      211.0
B32                              Sicilian defense      211.0
D51                                           QGD      211.0
E15                                Queen's Indian      211.0
A49                                 King's Indian      209.0
C05                                        French      208.0
D90                                     Gruenfeld      208.0
B50                                      Sicilian      207.0
E60                         King's Indian defense      207.0
A25                                       English      205.0
C55 Two knights defense (Modern Bishop's Opening)      205.0
D82                                     Gruenfeld      205.0
B10                                     Caro-Kann      204.0
B20                                      Sicilian      204.0
C08                                        French      204.0
C60                                     Ruy Lopez      204.0
E14                                Queen's Indian      204.0
A16                               English Opening      203.0
A20                               English Opening      203.0
C43                                        Petrov      203.0
E10                             Queen's pawn game      203.0
A57                                  Benko gambit      202.0
D10          QGD Slav defense, Alekhine Variation      202.0
A30                                       English      200.0
A15                               English Opening      199.0
C57                           Two knights defense      199.0
D03          Torre attack (Tartakower Variation )      199.0
E30                                  Nimzo-Indian      199.0
B30                                      Sicilian      198.0
A46                             Queen's pawn game      197.0
A48                                 King's Indian      197.0
B22                                      Sicilian      197.0
C53                                  Giuoco Piano      197.0
E24                                  Nimzo-Indian      197.0
C00                                        French      196.0
D21                                           QGA      196.0
C15                                        French      195.0
A34                                       English      194.0
C24                              Bishop's Opening      194.0
E61                  King's Indian defense, 3.Nc3      194.0
A45  Trompovsky attack (Ruth, Opovcensky Opening)      193.0
B90                                      Sicilian      193.0
D31                                           QGD      193.0
D85                                     Gruenfeld      192.0
C42                     Petrov Three knights game      191.0
C64                                     Ruy Lopez      190.0
C65                                     Ruy Lopez      190.0
B23                                      Sicilian      189.0
E70                                 King's Indian      189.0
A56                                Benoni defense      188.0
A21         English, Kramnik-Shirov counterattack      187.0
D02                           Queen's Bishop game      187.0
B27                                      Sicilian      185.0
B40                              Sicilian defense      184.0
E00                               Catalan Opening      184.0
E32                                  Nimzo-Indian      183.0
A27                                       English      180.0
C10                                        French      179.0
A18                                       English      178.0
C11                                        French      178.0
C50                                  Giuoco Piano      178.0
D70                         Neo-Gruenfeld defense      176.0
D20                                           QGA      174.0
A19                                       English      173.0
C03                                        French      168.0
C16                                        French      168.0
E12                                Queen's Indian      165.0
C69                                     Ruy Lopez      163.0

python source
"""
game src: http://www.fastgm.de/10min.html

Dependencies:
   pip install chess
   pip install pandas
"""

import chess.pgn
import pandas as pd


fn = 'Top10-10min.pgn'

data = []

with open(fn, 'r') as f:
    while True:
        game = chess.pgn.read_game(f)
        if game is None:
            break

        plycnt = int(game.headers['PlyCount'])
        eco = game.headers['ECO']
        opening = game.headers['Opening']
        data.append([eco, opening, plycnt])

df = pd.DataFrame(data)
df.columns = ['eco', 'opening', 'plies']
df.to_csv('plies.csv', index=False)

print(f'file: {fn}')
print('src: http://www.fastgm.de/10min.html')
print('Game Ply Stats')

print(f'Average: {df["plies"].mean().round()}')
print(f'Minimum: {df["plies"].min()}')
print(f'Maximum: {df["plies"].max()}')
print(f'Stdev: {df["plies"].std().round()}')

df1 = df.groupby('eco', as_index=False, sort=False).agg({'plies': 'mean', 'eco': 'first', 'opening': 'first'})
df1.plies = df1.plies.round()
df1 = df1.rename(columns={'plies': 'ave_plies'})
df1 = df1[['eco', 'opening', 'ave_plies']]

print(f'Average plies by ECO')
df1 = df1.sort_values(by=['ave_plies', 'eco'], ascending=[False, True])
print(df1.to_string(index=False))


user9192: Since actual games are almost always imperfect play, there is no logical number of moves from a given position, since the actual players would generally not play perfectly if forced to continue the game to the end. However, you can probably estimate the number of moves it would take a given pair of human players P1,P2 to finish a game past a resignation, by calibrating computer players C1,C2 to play similarly to each of them, and then using C1,C2 to finish the game! From this you can then obtain an estimate of the average number of moves that P1,P2 would take per chess game that they played but stopped upon resignation.
The question then is, how can we calibrate computer players? A crude first-order approximation is as follows: Measure the centipawn loss distribution f of the human player over the opening and the middle-game and the end-game, according to an engine like StockFish. Then construct a smoothed version F of the cumulative function for f. Now make the computer player choose each move such that the smoothed cumulative function for the centipawn loss distribution for the chosen move is as close as possible to F!
Better approximations are of course not hard to achieve. Just like Lichess can tailor puzzles to your weaknesses, which are all automatically computed, so also you can have different loss distributions for different types of moves (treating each position as a puzzle). It doesn't matter if the categories are humanly crafted (e.g. forks, pins, skewers, ...), because the goal is just to get a better result and not necessarily converge to a perfect simulation.

user4418: 
Is there a way to figure out the average number of moves of a game?

The best way is to run a program which goes through a large database of games and calculates the average number of moves per game.

The number of moves on record does not reflect the actual logical number of moves of which a game should consist.

Games of chess are played between players of many different strengths. The "logical number of moves" a game should last after a particular position, even one where one player has lost queen for rook, will depend on the strengths of the two players and what mistakes they make on the way to finishing the game. That means that there is no "logical number of moves of which a game should consist". There is only the actual number of moves of the game.

32561: <p>Is there a way to figure out the average number of moves of a game? Looking at games on record, it is 40 or so. OK, but what about in pure chess sense? For instance, I was looking at game in which one player won Queen for Rook in the middle game. After a few moves the weaker side resigned. Fair enough. But playing the game out to the final result took seventy or so more moves! The number of moves on record does not reflect the actual logical number of moves of which a game should consist.</p>
 1947: <p>In a pure sense, you would have to play out (virtually simulate) all possible games and then take the average number of moves across all of them.</p>
<p>You could start with the <a href="https://en.wikipedia.org/wiki/Shannon_number" rel="nofollow noreferrer">Shannon Number</a> as an idea of roughly how much computing power you would need (hint: it's more than is available in our universe) but since it's based on estimating the average game length it wouldn't work for determining that length itself without enumerating all of possible games.</p>
<p>What is more interesting is to look at the number of possible moves after each number of plies as well as the number of checkmates (or more generally, any end of the game).   For the first 9 plies one in 6095 games has ended in checkmate, but comparing to 1 in 8628 for the first 8 plies, 1 in 8334 for the first 7 plies, and 1 in 10996 for the first 6 plies (as well as a little common sense) it's obvious that the percentage of checkmates after a given ply, while not always increasing, is tending in that direction.  If you plotted this curve of percentage of games ended by the nth ply you <em>might</em> (assuming the path isn't too chaotic) start to estimate how the curve might continue past the limits of your computations and get a rough guess as to the average length.</p>
<p>Best case with some smoothing you might find some kind of bell-like curve where most games end in the middle, with a few obvious truncation artifacts from things like the 50 move rule preventing a long tail.</p>
<p>You could also try a Monte Carlo simulation of games randomly chosen from legal moves. While most paths on the game tree consist of lots of moves that make no strategic or tactical sense, this might give you a &quot;truer&quot; picture of the actual average length of the whole game tree.  Or if you are only interested in certain types of games you could create games played between computers of various strengths.</p>
 30545: <p>Here are the results based from the games at TC 10minutes + 6s inc. The games are not adjudicated. You can download the games at <a href="http://www.fastgm.de/10min.html" rel="nofollow noreferrer">http://www.fastgm.de/10min.html</a>.</p>
<p>These games have PlyCount tag, we can use this to get the approximate average number of moves on the games. You can use python chess modules to do this.</p>
<p>pgn file: Top10-10min.pgn</p>
<pre><code>average ply: 198
approximate average number of moves: 99
</code></pre>
<p>Python code</p>
<pre><code>import chess
import chess.pgn
import statistics


fn = 'Top10-10min.pgn'

data = []

with open(fn, 'r') as f:
    while True:
        game = chess.pgn.read_game(f)
        if game is None:
            break

        plycnt = int(game.headers['PlyCount'])
        data.append(plycnt)


print(f'average ply: {statistics.mean(data)}, approximate average number of moves: {statistics.mean(data)//2}')
</code></pre>
<h2>Other stats on ply numbers.</h2>
<pre><code>file: Top10-10min.pgn
src: http://www.fastgm.de/10min.html

Game Ply Stats
Average: 198.0
Minimum: 25
Maximum: 909
Stdev: 96.0
</code></pre>
<h5>Average plies by ECO</h5>
<pre><code>eco                                       opening  ave_plies
D80                                     Gruenfeld      225.0
E45                                  Nimzo-Indian      222.0
A17                                       English      221.0
E20                                  Nimzo-Indian      218.0
E11      Bogo-Indian defense, Gruenfeld Variation      216.0
E22                                  Nimzo-Indian      215.0
C07                                        French      214.0
D30                       Queen's gambit declined      214.0
B17                                     Caro-Kann      213.0
C70                                     Ruy Lopez      213.0
A11                                       English      211.0
A13                               English Opening      211.0
B32                              Sicilian defense      211.0
D51                                           QGD      211.0
E15                                Queen's Indian      211.0
A49                                 King's Indian      209.0
C05                                        French      208.0
D90                                     Gruenfeld      208.0
B50                                      Sicilian      207.0
E60                         King's Indian defense      207.0
A25                                       English      205.0
C55 Two knights defense (Modern Bishop's Opening)      205.0
D82                                     Gruenfeld      205.0
B10                                     Caro-Kann      204.0
B20                                      Sicilian      204.0
C08                                        French      204.0
C60                                     Ruy Lopez      204.0
E14                                Queen's Indian      204.0
A16                               English Opening      203.0
A20                               English Opening      203.0
C43                                        Petrov      203.0
E10                             Queen's pawn game      203.0
A57                                  Benko gambit      202.0
D10          QGD Slav defense, Alekhine Variation      202.0
A30                                       English      200.0
A15                               English Opening      199.0
C57                           Two knights defense      199.0
D03          Torre attack (Tartakower Variation )      199.0
E30                                  Nimzo-Indian      199.0
B30                                      Sicilian      198.0
A46                             Queen's pawn game      197.0
A48                                 King's Indian      197.0
B22                                      Sicilian      197.0
C53                                  Giuoco Piano      197.0
E24                                  Nimzo-Indian      197.0
C00                                        French      196.0
D21                                           QGA      196.0
C15                                        French      195.0
A34                                       English      194.0
C24                              Bishop's Opening      194.0
E61                  King's Indian defense, 3.Nc3      194.0
A45  Trompovsky attack (Ruth, Opovcensky Opening)      193.0
B90                                      Sicilian      193.0
D31                                           QGD      193.0
D85                                     Gruenfeld      192.0
C42                     Petrov Three knights game      191.0
C64                                     Ruy Lopez      190.0
C65                                     Ruy Lopez      190.0
B23                                      Sicilian      189.0
E70                                 King's Indian      189.0
A56                                Benoni defense      188.0
A21         English, Kramnik-Shirov counterattack      187.0
D02                           Queen's Bishop game      187.0
B27                                      Sicilian      185.0
B40                              Sicilian defense      184.0
E00                               Catalan Opening      184.0
E32                                  Nimzo-Indian      183.0
A27                                       English      180.0
C10                                        French      179.0
A18                                       English      178.0
C11                                        French      178.0
C50                                  Giuoco Piano      178.0
D70                         Neo-Gruenfeld defense      176.0
D20                                           QGA      174.0
A19                                       English      173.0
C03                                        French      168.0
C16                                        French      168.0
E12                                Queen's Indian      165.0
C69                                     Ruy Lopez      163.0
</code></pre>
<h5>python source</h5>
<pre><code>&quot;&quot;&quot;
game src: http://www.fastgm.de/10min.html

Dependencies:
   pip install chess
   pip install pandas
&quot;&quot;&quot;

import chess.pgn
import pandas as pd


fn = 'Top10-10min.pgn'

data = []

with open(fn, 'r') as f:
    while True:
        game = chess.pgn.read_game(f)
        if game is None:
            break

        plycnt = int(game.headers['PlyCount'])
        eco = game.headers['ECO']
        opening = game.headers['Opening']
        data.append([eco, opening, plycnt])

df = pd.DataFrame(data)
df.columns = ['eco', 'opening', 'plies']
df.to_csv('plies.csv', index=False)

print(f'file: {fn}')
print('src: http://www.fastgm.de/10min.html')
print('Game Ply Stats')

print(f'Average: {df[&quot;plies&quot;].mean().round()}')
print(f'Minimum: {df[&quot;plies&quot;].min()}')
print(f'Maximum: {df[&quot;plies&quot;].max()}')
print(f'Stdev: {df[&quot;plies&quot;].std().round()}')

df1 = df.groupby('eco', as_index=False, sort=False).agg({'plies': 'mean', 'eco': 'first', 'opening': 'first'})
df1.plies = df1.plies.round()
df1 = df1.rename(columns={'plies': 'ave_plies'})
df1 = df1[['eco', 'opening', 'ave_plies']]

print(f'Average plies by ECO')
df1 = df1.sort_values(by=['ave_plies', 'eco'], ascending=[False, True])
print(df1.to_string(index=False))
</code></pre>
 9192: <p>Since actual games are almost always imperfect play, there is no <strong>logical</strong> number of moves from a given position, since the actual players would generally not play perfectly if forced to continue the game to the end. However, you can probably estimate the number of moves it would take a given pair of human players P1,P2 to finish a game past a resignation, by calibrating computer players C1,C2 to play similarly to each of them, and then using C1,C2 to finish the game! From this you can then obtain an estimate of the <strong>average</strong> number of moves that P1,P2 would take per chess game that they played but stopped upon resignation.</p>
<p>The question then is, how can we calibrate computer players? A crude first-order approximation is as follows: Measure the centipawn loss distribution f of the human player over the opening and the middle-game and the end-game, according to an engine like StockFish. Then construct a smoothed version F of the cumulative function for f. Now make the computer player choose each move such that the smoothed cumulative function for the centipawn loss distribution for the chosen move is as close as possible to F!</p>
<p>Better approximations are of course not hard to achieve. Just like Lichess can tailor puzzles to your weaknesses, which are all automatically computed, so also you can have different loss distributions for different types of moves (treating each position as a puzzle). It doesn't matter if the categories are humanly crafted (e.g. forks, pins, skewers, ...), because the goal is just to get a better result and not necessarily converge to a perfect simulation.</p>
 4418: <blockquote>
<p>Is there a way to figure out the average number of moves of a game?</p>
</blockquote>
<p>The best way is to run a program which goes through a large database of games and calculates the average number of moves per game.</p>
<blockquote>
<p>The number of moves on record does not reflect the actual logical number of moves of which a game should consist.</p>
</blockquote>
<p>Games of chess are played between players of many different strengths. The &quot;logical number of moves&quot; a game should last after a particular position, even one where one player has lost queen for rook, will depend on the strengths of the two players and what mistakes they make on the way to finishing the game. That means that there is no &quot;logical number of moves of which a game should consist&quot;. There is only the actual number of moves of the game.</p>
