6

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)

7
  • What do you mean by 'combinations'? The number of different board positions possible with the pieces you specified?
    – Tony Ennis
    Jan 27, 2014 at 3:38
  • @TonyEnnis Just the combination of piece frequencies, not board positions. Jan 27, 2014 at 3:52
  • Do you distinguish between white and black pieces? Jan 27, 2014 at 8:55
  • 1
    unclear question, would you be more specific @AdamSpeight ?
    – mounaim
    Jan 27, 2014 at 10:39
  • 1
    I think you need to write a code for this and then run it and then get an answer :)
    – user2001
    Jan 27, 2014 at 12:45

3 Answers 3

3

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.

7
  • 2
    This is the correct number if you don't include pawn promotion. Jan 27, 2014 at 12:38
  • @DagOskarMadsen would you please check my edit for the answer ?
    – mounaim
    Jan 28, 2014 at 14:20
  • @Adam Speight check my edit for the answer :)
    – mounaim
    Jan 28, 2014 at 14:21
  • Actually there can be 16 promotions: chess.stackexchange.com/questions/4128/…, but in a legal game then some of the other pieces must have bee captured on the way. If you only consider legal games, then this becomes a very hard chess question rather than a mathematical question. Jan 28, 2014 at 14:26
  • Thanks @DagOskarMadsen for this beautiful game with 16 queens, I thought this was just impossible !
    – mounaim
    Jan 28, 2014 at 14:48
2

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

1
  • 1
    Actually, for a pawn to able to promote it is necessary that the pawn in front moves aside (taking a piece or another pawn) or is taken.
    – lodebari
    Oct 15, 2015 at 6:02
1

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?

15
  • There are some other restrictions. If there are 20 rooks, then there cannot be more than 4 knights, for instance. Jan 30, 2014 at 2:54
  • @DagOskarMadsen Good point, which suggest the value is lower than these upper bounds. Jan 30, 2014 at 2:59
  • Adding the constraint Sum(r,n,b,a)<= (20-p) reduces the combinations to 53068 and 3060 Jan 30, 2014 at 3:14
  • The question now says "...all theoretically possible games played from the initial position ....". If you have a large number of promotions, then there must have been several captures on the way. It is going to be very hard to calculate the exact answer, maybe an upper bound is the most we can hope for. Jan 30, 2014 at 9:16
  • I think the constraint should be Sum(r,n,b,q)<= (30-p) Jan 30, 2014 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.