user2347: My question concerns the total material available on the chess board (black+white pieces). At the very beginning of a game, there are 2 Kings, 2 Queens, 4 Rooks, 4 Bishops, 4 Knights and 16 pawns. These can be represented by an array (2, 2, 4, 4, 4, 16). As the game progresses, the total amount of material will change, thus the array will change. My question is as follows. Looking at all theoretically possible games played from the initial position, how many unique arrays are possible to reach? The fact that a pawn can be promoted to any light or heavy piece makes the problem even more tricky!
Initial Board
16 Pawns
 4 Rooks
 4 Bishops
 4 Knights
 2 Queens
 2 Kings

After a pawn capture
15 Pawns
 4 Rooks
 4 Bishops
 4 Knights
 2 Queens
 2 Kings 

Only kings left
 0 Pawns
 0 Rooks
 0 Bishops
 0 Knights
 0 Queens
 2 Kings

But it get more complex when you include pawn promotion (to any piece excluding pawn and king). 
So what is the total number of combinations?

I've listed 3 combinations above. Here a 6 more
 P  R  N  B  Q  K
32  4  4  4  2  2  Initial Position and remains the same until a capture
32  3  4  4  2  2  First capture frequency combinations.  
32  4  3  4  2  2
32  4  4  3  2  2
32  4  4  4  1  2
31  4  4  4  2  2  Pawn 
etc
etc
0  0  0  0  0  2  Only Kings

It get tricky at pawn promotion cos each of the 16 pawns can turn in one of 4 pieces (R B N Q).  Which is why I curious to know the total number of (unique piece frequencies)

user2347: I know that the upper limit can not be greater than 2304000
Which is the answer to the following
16 (Pawns) * 20 (Rooks) * 20 (Knights) * 20 (Bishops) * 18 (Queens)

But not all of those are possible, so doing a quick programming
 c:= 0
 p:= 0 .. 16
 r:= 0 .. 20
 b:= 0 .. 20
 n:= 0 .. 20
 q:= 0 .. 18
 if Sum( p, r, b, n, q, 2) <= 32 then c+=1

Calculates c to be 305090 combinations. (218 < c < 219)
If I just focus on end games (no pawns) I calculate c to be 3060  211 < c < 212
Is my algorithm producing the correct results?

user8495: Initialy I posted that only 8 promotions for both sides are posible because pawns are oposed in the same file and to promote one have to be taken.
Edited:
I think that for each promotion one pawn or a piece shoud be taken. Because pawns are in front of each other ,blacks and whites ,to promote one of both have to move to the side(take another piece or pawn) or be taken. then I recalculated the final result to 80094 diferent legal piece combinations. I created this script to show all (i modified thanks to the comments of lodebari)
(function (pieceset) {
    'use strict';
    var n = 0,
        cc = function cc(arr) {
            var temparr=arr.slice(0);
            while (temparr[0]>=0) {
                while (temparr[1]>=0) {
                    while (temparr[2]>=0) {
                        while (temparr[3]>=0) {
                            while (temparr[4]>=0) {
                                var maxp = 0;
                                var nump = temparr[1]+temparr[2]+temparr[3]+temparr[4]; 
                                if (temparr[1]>4) maxp+=(temparr[1]-4);
                                if (temparr[2]>4) maxp+=(temparr[2]-4);
                                if (temparr[3]>4) maxp+=(temparr[3]-4);
                                if (temparr[4]>2) maxp+=(temparr[4]-2);
                                nump = nump - maxp;
                                if ((maxp+temparr[0]<=16)&&((nump+temparr[0]+(maxp*2))<=30)) {
                                    n++;
                                    console.log(n,"->",temparr);
                                }
                                temparr[4]=temparr[4]-1;
                            }
                            temparr[4]=arr[4];
                            temparr[3]=temparr[3]-1;
                        }
                        temparr[3]=arr[3];
                        temparr[2]=temparr[2]-1;
                    }
                    temparr[2]=arr[2];
                    temparr[1]=temparr[1]-1;
                }
                temparr[1]=arr[1];
                temparr[0]=temparr[0]-1;
            }
            return 0;
        };
    cc(pieceset);
}([16,20,20,20,18,2]));

When you run it it print lines like this:
1 '->' [ 16, 4, 4, 4, 2, 2 ]

the fist number its the combination number followed by Pawns,Rooks,Knights,Bishops,Queens,Kings. The fist line corresponds the fist position with full board, and the last with the two kings alone.
You can try here : https://repl.it/xlO/4

user2282: It's :
numberOfPawnsPieces(=17) * numberOfRooksPieces(=5) * numberOfBishopsPieces(=5) * numberOfKnightsPieces(=5) * numberOfQueensPieces(=3) * numberOfKingsPieces(=1)
= 6375 
I added one to each number of same piece in case there is no one of its kind(for queens for example, there may be two queens, one queen, or none), except for Kings where there always must be 2 kings on the board, so the number of combinations for kings number is only 1.  
**
EDIT : In cas there is promotions of pawns
**
My idea to tackle this is to separate all possible cases, i.e. when there is promotion of 1 pawn, promotion of 2 pawns,...,promotion of 8 pawns. ( 8 pawns is the maximum number of possible promotions )
Generally speaking, when x pawns are promoted, we will proceed same as above, but the number of pawns will be in each case (16-x), plus an other group of 4 * x possibly created pieces. Finally we will sum all over the cases :
                17*5*5*5*3*1 + SUM[x=1-->16,(16-x+1)*5*5*5*3*(4*x)] = **1 230 375**

This is approximate, I may have forgotten some cases, or added some positions that are just impossible to happen in a chess game,...etc.

2347: <p>My question concerns the total material available on the chess board (black+white pieces). At the very beginning of a game, there are 2 Kings, 2 Queens, 4 Rooks, 4 Bishops, 4 Knights and 16 pawns. These can be represented by an array (2, 2, 4, 4, 4, 16). As the game progresses, the total amount of material will change, thus the array will change. My question is as follows. Looking at all theoretically possible games played from the initial position, how many unique arrays are possible to reach? The fact that a pawn can be promoted to any light or heavy piece makes the problem even more tricky!</p>

<p>Initial Board</p>

<pre><code>16 Pawns
 4 Rooks
 4 Bishops
 4 Knights
 2 Queens
 2 Kings
</code></pre>

<p>After a pawn capture</p>

<pre><code>15 Pawns
 4 Rooks
 4 Bishops
 4 Knights
 2 Queens
 2 Kings 
</code></pre>

<p>Only kings left</p>

<pre><code> 0 Pawns
 0 Rooks
 0 Bishops
 0 Knights
 0 Queens
 2 Kings
</code></pre>

<p>But it get more complex when you include pawn promotion (to any piece excluding pawn and king). </p>

<p>So what is the total number of combinations?</p>

<hr>

<p>I've listed 3 combinations above. Here a 6 more</p>

<pre><code> P  R  N  B  Q  K
32  4  4  4  2  2  Initial Position and remains the same until a capture
32  3  4  4  2  2  First capture frequency combinations.  
32  4  3  4  2  2
32  4  4  3  2  2
32  4  4  4  1  2
31  4  4  4  2  2  Pawn 
etc
etc
0  0  0  0  0  2  Only Kings
</code></pre>

<p>It get tricky at pawn promotion cos each of the 16 pawns can turn in one of 4 pieces (R B N Q).  Which is why I curious to know the total number of (unique piece frequencies)</p>
 2347: <p>I know that the upper limit can not be greater than <strong>2304000</strong>
Which is the answer to the following</p>

<pre><code>16 (Pawns) * 20 (Rooks) * 20 (Knights) * 20 (Bishops) * 18 (Queens)
</code></pre>

<p>But not all of those are possible, so doing a quick programming</p>

<pre><code> c:= 0
 p:= 0 .. 16
 r:= 0 .. 20
 b:= 0 .. 20
 n:= 0 .. 20
 q:= 0 .. 18
 if Sum( p, r, b, n, q, 2) &lt;= 32 then c+=1
</code></pre>

<p>Calculates <strong>c</strong> to be <strong>305090</strong> combinations. (2<sup>18</sup> &lt; c &lt; 2<sup>19</sup>)</p>

<p>If I just focus on end games (no pawns) I calculate <strong>c</strong> to be <strong>3060</strong>  2<sup>11</sup> &lt; c &lt; 2<sup>12</sup></p>

<p>Is my algorithm producing the correct results?</p>
 8495: <p>Initialy I posted that only 8 promotions for both sides are posible because pawns are oposed in the same file and to promote one have to be taken.</p>

<p>Edited:</p>

<p>I think that for each promotion one pawn or a piece shoud be taken. Because pawns are in front of each other ,blacks and whites ,to promote one of both have to move to the side(take another piece or pawn) or be taken. then I recalculated the final result to <strong>80094</strong> diferent legal piece combinations. I created this script to show all (i modified thanks to the comments of lodebari)</p>

<pre><code>(function (pieceset) {
    'use strict';
    var n = 0,
        cc = function cc(arr) {
            var temparr=arr.slice(0);
            while (temparr[0]&gt;=0) {
                while (temparr[1]&gt;=0) {
                    while (temparr[2]&gt;=0) {
                        while (temparr[3]&gt;=0) {
                            while (temparr[4]&gt;=0) {
                                var maxp = 0;
                                var nump = temparr[1]+temparr[2]+temparr[3]+temparr[4]; 
                                if (temparr[1]&gt;4) maxp+=(temparr[1]-4);
                                if (temparr[2]&gt;4) maxp+=(temparr[2]-4);
                                if (temparr[3]&gt;4) maxp+=(temparr[3]-4);
                                if (temparr[4]&gt;2) maxp+=(temparr[4]-2);
                                nump = nump - maxp;
                                if ((maxp+temparr[0]&lt;=16)&amp;&amp;((nump+temparr[0]+(maxp*2))&lt;=30)) {
                                    n++;
                                    console.log(n,"-&gt;",temparr);
                                }
                                temparr[4]=temparr[4]-1;
                            }
                            temparr[4]=arr[4];
                            temparr[3]=temparr[3]-1;
                        }
                        temparr[3]=arr[3];
                        temparr[2]=temparr[2]-1;
                    }
                    temparr[2]=arr[2];
                    temparr[1]=temparr[1]-1;
                }
                temparr[1]=arr[1];
                temparr[0]=temparr[0]-1;
            }
            return 0;
        };
    cc(pieceset);
}([16,20,20,20,18,2]));
</code></pre>

<p>When you run it it print lines like this:</p>

<pre><code>1 '-&gt;' [ 16, 4, 4, 4, 2, 2 ]
</code></pre>

<p>the fist number its the combination number followed by Pawns,Rooks,Knights,Bishops,Queens,Kings. The fist line corresponds the fist position with full board, and the last with the two kings alone.</p>

<p>You can try here : <a href="https://repl.it/xlO/4" rel="nofollow">https://repl.it/xlO/4</a></p>
 2282: <p>It's :<br>
numberOfPawnsPieces(=17) * numberOfRooksPieces(=5) * numberOfBishopsPieces(=5) * numberOfKnightsPieces(=5) * numberOfQueensPieces(=3) * numberOfKingsPieces(=1)<br>
= 6375 </p>

<p>I added one to each number of same piece in case there is no one of its kind(for queens for example, there may be two queens, one queen, or none), except for Kings where there always must be 2 kings on the board, so the number of combinations for kings number is only 1.  </p>

<p>**</p>

<p><strong>EDIT : In cas there is promotions of pawns</strong></p>

<p>**<br>
My idea to tackle this is to separate all possible cases, i.e. when there is promotion of 1 pawn, promotion of 2 pawns,...,promotion of 8 pawns. ( 8 pawns is the maximum number of possible promotions )<br>
Generally speaking, when <code>x</code> pawns are promoted, we will proceed same as above, but the number of pawns will be in each case (16-x), plus an other group of <code>4 * x</code> possibly created pieces. Finally we will sum all over the cases :</p>

<pre><code>                17*5*5*5*3*1 + SUM[x=1--&gt;16,(16-x+1)*5*5*5*3*(4*x)] = **1 230 375**
</code></pre>

<p>This is approximate, I may have forgotten some cases, or added some positions that are just impossible to happen in a chess game,...etc.</p>
