Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Never Say "Impossible"

Author: Uri Blass

Date: 04:00:52 05/18/01

Go up one level in this thread


On May 18, 2001 at 02:29:46, Dann Corbit wrote:

>On May 18, 2001 at 01:26:51, Uri Blass wrote:
>[snip]
>>I agree with the idea except that 168 is too much and you should use 155 bit
>>numbers.
>>
>>My counting program proved that the number of legal positions is less than 2^155
>
>Do you actually have a 155 bit encoding for chess positions?
>
>If so, I would be keenly interested to see it.
>[snip]

I have the following problems in doing it.

1)I cannot use big integers and when I try to create a default project for my
modified program that I got from you more than a year ago I get the following
error

fatal error C1083: Cannot open include file: 'qhead.h': No such file or
directory
Error executing cl.exe.

Here is the relevant program that you sent me(I believe that I did not modify it
but I may be wrong and maybe i modified it when i tried to fix the problem
without success)

#include <iostream.h>
#include "qhead.h"
#include "qfloat.h"

int main (void)
{
  char x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, j, i, a;
  qfloat k, n = 0;
  qfloat m[65], w[65];
  m[0] = 1;
  w[0] = 0;
  for (i = 1; i < 65; i++)
    {
      w[i] = 0;
      m[i] = m[i - 1] * (qfloat)(double) i;
    }
  n = 0;
  for (x1 = 0; x1 < 9; x1++)
  {
	  cout << "new x1:" << x1 << endl;
    for (x2 = 0; x2 < 11 - x1; x2++)
	{
	  cout << "new x2:" << x2 << endl;
      for (x3 = 0; (x3 < 11 - x1 && x1 + x2 + x3 < 13); x3++)
        for (x4 = 0; (x4 < 11 - x1 && x1 + x2 + x4 < 13 && x1 + x3 + x4 < 13 &&
x1 + x2 + x3 + x4 < 15); x4++)
          for (x5 = 0; (x5 < 10 - x1 && x1 + x2 + x5 < 12 && x1 + x3 + x5 < 12
&& x1 + x4 + x5 < 12 && x1 + x2 + x3 + x5 < 14 && x1 + x2 + x4 + x5 < 14 && x1 +
x3 + x4 + x5 < 14 && x1 + x2 + x3 + x4 + x5 < 16); x5++)
            {
              k = m[x2] * m[x3] * m[x4] * m[x5];
              i = 0;
              if (x2 > 2)
                i = i + x2 - 2;
              if (x3 > 2)
                i = i + x3 - 2;
              if (x4 > 2)
                i = i + x4 - 2;
              if (x5 > 1)
                i = i + x5 - 1;
              for (y1 = 0; y1 < 9; y1++)
                for (y2 = 0; y2 < 11 - y1; y2++)
                  for (y3 = 0; (y3 < 11 - y1 && y1 + y2 + y3 < 13); y3++)
                    for (y4 = 0; (y4 < 11 - y1 && y1 + y2 + y4 < 13 && y1 + y3 +
y4 < 13 && y1 + y2 + y3 + y4 < 15); y4++)
                      for (y5 = 0; (y5 < 10 - y1 && y1 + y2 + y5 < 12 && y1 + y3
+ y5 < 12 && y1 + y4 + y5 < 12 && y1 + y2 + y3 + y5 < 14 && y1 + y2 + y4 + y5 <
14 && y1 + y3 + y4 + y5 < 14 && y1 + y2 + y3 + y4 + y5 < 16); y5++)
                        {
                          j = 0;
                          if (y2 > 2)
                            j = j + y2 - 2;
                          if (y3 > 2)
                            j = j + y3 - 2;
                          if (y4 > 2)
                            j = j + y4 - 2;
                          if (y5 > 1)
                            j = j + y5 - 1;
                          a = x1 + x2 + x3 + x4 + x5 + y1 + y2 + y3 + y4 + y5;
                          if ((i <= 2 * (15 - y1 - y2 - y3 - y4 - y5) + (15 - x1
- x2 - x3 - x4 - x5)) && (j <= 2 * (15 - x1 - x2 - x3 - x4 - x5) + (15 - y1 - y2
- y3 - y4 - y5)))
                              w[a] = w[a] + (m[48] / (m[x1] * m[y1] * m[48 - x1
- y1])) * (m[64 - x1 - y1] / (k * m[y2] * m[y3] * m[y4] * m[y5] * m[62 - x1 - y1
- x2 - x3 - x4 - x5 - y2 - y3 - y4 - y5]));
                        }
		  }
		  }
            }
  k = 0;
  for (i = 0; i < 31; i++)
    {
      cout <<  i << w[i] << endl;
      k += w[i];
    }
  cout << k << endl;
  return 0;
}

The best that I know to do with visual c++ is __int64 and it is not enough.

2)I do not know an easy way to translate a material structure to a number.

If you can give me a code to translate every pseudo legal position of 32 pieces
to a number then it can help.

By the words pseudo legal position with 32 pieces I mean position when all the
pieces are at different squares when all the pawns are not in the first rank or
the last rank.

By translating to numbers I mean to the following assumptions:
a)Every position gets a different number
b)there is a position that is translated to 0
c)if there is a position that is translated to n when n is not 0 then there is
a position that is translated to n-1.

Uri



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.