Author: Reinhard Scharnagl
Date: 09:33:39 08/27/04
Go up one level in this thread
On August 27, 2004 at 12:21:14, Reinhard Scharnagl wrote:
>On August 27, 2004 at 11:08:32, morphy wrote:
>
>>On August 27, 2004 at 10:53:51, Reinhard Scharnagl wrote:
>>
>>>On August 27, 2004 at 10:45:51, Álvaro Begué wrote:
>>>
>>>>On August 27, 2004 at 10:40:30, morphy wrote:
>>>>
>>>>>I extract this from a my actual work:
>>>>>----------------
>>>>>[...]
>>>>>Now we can calculate all possible dispositions of white and black pawns on the
>>>>>chessboard:
>>>>>> combAllP(48);
>>>>> 49095494654933238
>>>
>>>>I only get 29019905518636890. Am I doing something wrong?
>>>
>>>You have done only 48!/(32!*8!*8!) thus (8+8) combinations.
>>>
>>>Reinhard.
>>
>>I'm sure, I calcultate all (nPW+nPB) combinations. I like your work in your site
>>but your coclusions seems to me forced and artificial,unnatural. I'm sorry but
>>i'm working on a most mathematically strict and complete work...but I can't show
>>it also because it's incomplete. for the present question read all the
>>motivation (extracted from a 'Maple 9.5' work)
>>
>>------------------
>>How to calculate all possible dispositions of all pieces on the chessboard?
>>
>>Start to calculate all possible dispositions of white pawns on theirs 48
>>possible squares.
>>> combPW:= (S,nPW) -> combinat[numbcomb](S,nPW);
>> combPW := (S, nPW) -> combinat[numbcomb](S, nPW)
>>Where 'combPW' count the number of combinations of 'nPW' white pawns in 'S'
>>squares. The reason is obvious from the same definition of number of
>>combinations of 'nPW' elements on 'S' places. In chess S=48 and nPW is a number
>>of white pawns from 1 to 8.
>>To add all possible disposition of black pawns, add for each of such combination
>>all the possible disposition of black pawns on a number of squares decreased by
>>number of white pawns on the chessboard.
>>> combPWB:= (S,nPW,nPB) -> combPW(S,nPW)*combinat[numbcomb](S-nPW,nPB);
>>combPWB := (S, nPW, nPB) -> combPW(S, nPW) combinat[numbcomb](S - nPW, nPB)
>>Since combinat[numbcomb](n,m) = n!/m!/(n-m)! and, because the way to calculate
>>the combinations is the same, combinat[numbcomb](S-nPW,nPB) = combPW(S-nPW,nPB),
>>we have:
>>> combPWB:= (S,nPW,nPB) -> S!/nPW!/nPB!/(S-nPW-nPB)!;
>> combPWB := (S, nPW, nPB) ->
>>
>> factorial(S)
>> ------------------------------------------------------
>> factorial(nPW) factorial(nPB) factorial(S - nPW - nPB)
>>So to calcultate all possible dispositions of white and black pawns we add all
>>terms above-written for all nPW and all nPB, both from 1 to 8.
>>> combAllP:= S -> sum(sum(combPWB(S,nPW,nPB),nPW=1..8),nPB=1..8);
>> 8 / 8 \
>> ----- |----- |
>> \ | \ |
>> ) | ) |
>> combAllP := S -> / | / combPWB(S, nPW, nPB)|
>> ----- |----- |
>> nPB = 1\nPW = 1 /
>>> combAllP:= S -> sum(sum(S!/nPW!/nPB!/(S-nPW-nPB)!,nPW=1..8),nPB=1..8);
>> 8 / 8
>> ----- |-----
>> \ | \
>> ) | )
>> combAllP := S -> / | /
>> ----- |-----
>> nPB = 1\nPW = 1
>>
>> \
>> |
>> |
>> factorial(S) |
>> ------------------------------------------------------|
>> factorial(nPW) factorial(nPB) factorial(S - nPW - nPB)|
>> /
>>Now we can calculate all possible dispositions of white and black pawns on the
>>chessboard:
>>> combAllP(48);
>> 49095494654933238
>>> evalf(%);
>> 16
>> 4.909549465 10
>>This is a significant result because we know how many possible 'pawns
>>structures' we can have: above to fifty millions of billions of pawns structure.
>>Assuming 1KB of data for 'Matrix of Values' for each pawn structure, we need to
>>store all this 'Matrix of Values' for all pawn structures about a million of
>>Hard Disks with a capacity of 50TB, not impossible for actual century.
>>-------------
>>
>>I hope to see you soon, Mr. Scharnagl
>>Regards
>>Giulio
>
>
>Well Giulio,
>
>a) I have a slightly different result:
>
>yours: 49095494654933238
>mine: 49095495585283107
>
>please check my approach:
>
> int i1, i2;
> long long sum1 = 0;
> for (i1 = 8; i1 >= 0; --i1) {
> for (i2 = 8; i2 >= 0; --i2) {
> long long sum2 = 1;
> long long quot1 = 1;
> for (int i3 = 48-i1-i2; ++i3 <= 48;) {
> sum2 *= i3;
> int i4 = 48 - i3;
> if (i4 < i1) {
> if (sum2 % (i1 - i4) != 0)
> quot1 *= (i1 - i4);
> else
> sum2 /= (i1 - i4);
> }
> if (i4 < i2) {
> if (sum2 % (i2 - i4) != 0)
> quot1 *= (i2 - i4);
> else
> sum2 /= (i2 - i4);
> }
> if (sum2 % quot1 != 0) {
> sum2 /= quot1;
> quot1 = 1;
> }
> }
> sum1 += sum2;
> }
> }
>
> cout << sum1 << endl << endl;
I saw always could be divided, therefor:
int i1, i2;
long long sum1 = 0;
for (i1 = 8; i1 >= 0; --i1) {
for (i2 = 8; i2 >= 0; --i2) {
long long sum2 = 1;
long long quot1 = 1;
for (int i3 = 48-i1-i2; ++i3 <= 48;) {
sum2 *= i3;
int i4 = 48 - i3;
if (i4 < i1) {
sum2 /= (i1 - i4);
}
if (i4 < i2) {
sum2 /= (i2 - i4);
}
}
sum1 += sum2;
}
}
>b) what exactly is your critic on my pages?
>
>Regards, Reinhard.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.