home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC-Online 1996 May
/
PCOnline_05_1996.bin
/
linux
/
source
/
xap
/
gchess
/
patch74.01
< prev
next >
Wrap
Text File
|
1995-10-10
|
10KB
|
374 lines
*** ../src/eval.c Sat Feb 11 05:54:43 1995
--- eval.c Mon Mar 6 13:50:07 1995
***************
*** 1574,1580 ****
pp = false;
break;
}
! z = (pp ? i - ((row (i) == 6) ? 8 : 16) : i);
Pd += ((pp) ? 5 * taxicab (sq, z) : taxicab (sq, z));
}
}
--- 1574,1580 ----
pp = false;
break;
}
! z = (pp ? i - ((row (i) == 1) ? 8 : 16) : i);
Pd += ((pp) ? 5 * taxicab (sq, z) : taxicab (sq, z));
}
}
*** ../src/search.c Wed Feb 22 08:46:50 1995
--- search.c Sat Mar 4 09:41:41 1995
***************
*** 269,275 ****
/* calculate avg time per move remaining */
ResponseTime = TimeControl.clock[side] / TimeControl.moves[side];
! ResponseTime += TCadd * 3 / 4;
TCleft = (int) ResponseTime / 5;
if (TimeControl.moves[side] < 5)
TCcount = MAXTCCOUNTX - 10;
--- 269,276 ----
/* calculate avg time per move remaining */
ResponseTime = TimeControl.clock[side] / TimeControl.moves[side];
! ResponseTime = ResponseTime * 2 / 3;
! ResponseTime += TCadd / 2;
TCleft = (int) ResponseTime / 5;
if (TimeControl.moves[side] < 5)
TCcount = MAXTCCOUNTX - 10;
***************
*** 1245,1251 ****
#endif
ElapsedTime (2);
TCcount++;
- if (et > ResponseTime) flag.timeout = true;
if (!background && Sdepth > 2)
{
if (best < alpha)
--- 1246,1251 ----
*** ../src/ttable.c Sun Feb 5 14:47:31 1995
--- ttable.c Sat Mar 25 13:55:05 1995
***************
*** 21,27 ****
struct hashentry *ttable[2];
unsigned long ttblsize;
! /* unsigned */ SHORT rehash; /* -1 is used as a flag --tpm */
#ifdef NEWAGE
utshort TTage; /* Current ttable age */
UTSHORT TTageClock, /* Count till next age tick */
--- 21,27 ----
struct hashentry *ttable[2];
unsigned long ttblsize;
! SHORT rehash; /* -1 is used as a flag --tpm */
#ifdef NEWAGE
utshort TTage; /* Current ttable age */
UTSHORT TTageClock, /* Count till next age tick */
***************
*** 98,177 ****
*/
{
! register struct hashentry *ptbl;
! register /*unsigned*/ SHORT i = 0; /*to match new type of rehash --tpm*/
#ifdef DEBUG
! if(flag.nott)return false;
#endif
#ifdef HASHSTATS
! ttprobe[depth]++;
#endif
! ptbl = &ttable[side][hashkey % ttblsize];
! while (true)
! {
! if (ptbl->depth == 0) return false;
! if (ptbl->hashbd == hashbd) break;
! if (++i > rehash) return false;
! ptbl++;
! }
PV = SwagHt = ptbl->mv;
! if ((ptbl->depth >= (SHORT) depth) || abs(ptbl->score)>9000)
! {
#ifdef HASHTEST
! for (i = 0; i < 32; i++)
! {
! if (ptbl->bd[i] != CB (i))
{
#ifdef HASHSTATS
! HashCol++;
! ShowMessage (CP[199]); /*ttable collision detected*/
#endif
! break;
}
- }
#endif /* HASHTEST */
#ifdef HASHSTATS
! ttdepthout[ptbl->depth]++;
! HashCnt++;
#endif
! #ifdef NEWAGE
! /* Find entry within rehash window or return failure */
! for (i=rehash, ptbl = &ttable[side][hashkey % ttblsize];
! ptbl->hashbd != hashbd; ptbl++)
! if (--i == 0) return false;
! /* Update age of rediscovered node */
! ptbl->age = TTage - TTdepthage[ptbl->depth];
! #endif
! if (ptbl->flags & truescore)
! {
! *score = ptbl->score;
! /* adjust *score so moves to mate is from root */
! if (*score > 9000) *score -= ply;
! else if (*score < -9000) *score += ply;
! *beta = -20000;
! }
! else if (ptbl->flags & lowerbound)
! {
! if (ptbl->score > *alpha)
#ifdef notdef
! *alpha = ptbl->score - 1;
#endif
! *alpha = ptbl->score;
! }
#ifdef DEBUG
! if (debuglevel & 32)
! {
algbr (PV >> 8, PV & 0xff, 0);
printf ("-get-> h=%lx d=%d s=%d p=%d a=%d b=%d %s\n", hashbd, depth, *score, ply, *alpha, *beta, mvstr);
! }
#endif
! return (true);
! }
! return (false);
}
inline
--- 98,178 ----
*/
{
! register struct hashentry *ptbl;
! register SHORT i = 0;
#ifdef DEBUG
! if(flag.nott)return false;
#endif
#ifdef HASHSTATS
! ttprobe[depth]++;
#endif
! #ifdef NEWAGE
! /* Find entry within rehash window or return failure */
! for (i=rehash, ptbl = &ttable[side][hashkey % ttblsize];
! ptbl->hashbd != hashbd; ptbl++)
! if (--i == 0) return false;
! /* Update age of rediscovered node */
! ptbl->age = TTage - TTdepthage[ptbl->depth];
! #else
! ptbl = &ttable[side][hashkey % ttblsize];
! while (true)
! {
! if (ptbl->depth == 0) return false;
! if (ptbl->hashbd == hashbd) break;
! if (++i > rehash) return false;
! ptbl++;
! }
! #endif
PV = SwagHt = ptbl->mv;
! if ((ptbl->depth >= (SHORT) depth) || abs(ptbl->score)>9000)
! {
#ifdef HASHTEST
! for (i = 0; i < 32; i++)
{
+ if (ptbl->bd[i] != CB (i))
+ {
#ifdef HASHSTATS
! HashCol++;
! ShowMessage (CP[199]); /*ttable collision detected*/
#endif
! break;
! }
}
#endif /* HASHTEST */
#ifdef HASHSTATS
! ttdepthout[ptbl->depth]++;
! HashCnt++;
#endif
! if (ptbl->flags & truescore)
! {
! *score = ptbl->score;
! /* adjust *score so moves to mate is from root */
! if (*score > 9000) *score -= ply;
! else if (*score < -9000) *score += ply;
! *beta = -20000;
! }
! else if (ptbl->flags & lowerbound)
! {
! if (ptbl->score > *alpha)
#ifdef notdef
! *alpha = ptbl->score - 1;
#endif
! *alpha = ptbl->score;
! }
#ifdef DEBUG
! if (debuglevel & 32)
! {
algbr (PV >> 8, PV & 0xff, 0);
printf ("-get-> h=%lx d=%d s=%d p=%d a=%d b=%d %s\n", hashbd, depth, *score, ply, *alpha, *beta, mvstr);
! }
#endif
! return (true);
! }
! return (false);
}
inline
***************
*** 191,207 ****
{
register struct hashentry *ptbl;
! register /*unsigned*/ SHORT i = 0; /*to match new type of rehash --tpm*/
ptbl = &ttable[side][hashkey % ttblsize];
while (true)
{
! if (ptbl->depth == 0
! #ifdef NEWAGE
! || TTage - ptbl->age > newage
! #endif
! ) break;
! if((ptbl->hashbd) == hashbd)if(ptbl->depth > (UCHAR)depth)return false; else break;
if (++i > rehash)
{
#ifdef HASHSTATS
--- 192,207 ----
{
register struct hashentry *ptbl;
! register SHORT i = 0;
! #ifndef NEWAGE
ptbl = &ttable[side][hashkey % ttblsize];
while (true)
{
! if (ptbl->depth == 0) break;
! if ((ptbl->hashbd) == hashbd) {
! if (ptbl->depth > (UCHAR)depth) return false; else break;
! }
if (++i > rehash)
{
#ifdef HASHSTATS
***************
*** 213,249 ****
}
ptbl++;
}
! #ifdef NEWAGE
! {
/* Look for match or oldest entry to reuse */
! int i;
! SHORT old = 0;
! struct hashentry * oldest = (struct hashentry *)NULL;
! for (i=rehash, ptbl = &ttable[side][hashkey % ttblsize];
! i > 0 && ptbl->hashbd != hashbd; i--, ptbl++)
! if ((TTage - ptbl->age) > old)
! {
! old = TTage - ptbl->age;
! oldest = ptbl;
! }
! if (i == 0)
! {
ptbl = oldest; /* reuse oldest entry */
! if (--TTageClock == 0)
! {
TTageClock = TTageRate;
TTage++; /* Everyone is now just a little older */
! }
! }
! ptbl->age = TTage - TTdepthage[ptbl->depth]; /* Set age of this node */
}
! #else
! TTadd++;
! #endif
#ifdef HASHSTATS
HashAdd++;
#endif
- if(ptbl->depth > (UCHAR)depth) return false;
ptbl->hashbd = hashbd;
ptbl->depth = (UCHAR) depth;
ptbl->score = score;
--- 213,257 ----
}
ptbl++;
}
! TTadd++;
! if (ptbl->depth > (UCHAR)depth) return false;
!
! #else /* NEWAGE */
! utshort old;
! struct hashentry *oldest;
!
/* Look for match or oldest entry to reuse */
! /* Note that arithmetic on ages is intentionally modulo 65536 */
! i = rehash;
! oldest = ptbl = &ttable[side][hashkey % ttblsize];
! old = TTage - ptbl->age;
! while (ptbl->hashbd != hashbd) {
! if (--i == 0) break;
! ptbl++;
! if ((TTage - ptbl->age) > old) {
! old = TTage - ptbl->age;
! oldest = ptbl;
! }
! }
! if (i == 0) {
ptbl = oldest; /* reuse oldest entry */
! #ifdef HASHSTATS
! THashCol++;
! #endif
! if (--TTageClock == 0) {
TTageClock = TTageRate;
TTage++; /* Everyone is now just a little older */
! }
! } else {
! /*!!! if (ptbl->depth > (UCHAR)depth) return false;*/
}
! /*!!!*/ if (ptbl->depth > (UCHAR)depth) return false;
! ptbl->age = TTage - TTdepthage[depth]; /* Set age of this node */
!
! #endif /* NEWAGE */
#ifdef HASHSTATS
HashAdd++;
#endif
ptbl->hashbd = hashbd;
ptbl->depth = (UCHAR) depth;
ptbl->score = score;
***************
*** 290,296 ****
{
TTageClock = TTageRate;
TTage = newage+1; /* Zero entries are pre-expired. */
- TTageRate = ttblsize/(newage/2); /* Average 1/2 of table will be expired */
/* zero the age of all ttable entries */
memset(ttable[white],0,sizeof(struct hashentry)*(unsigned)(ttblsize+rehash));
memset(ttable[black],0,sizeof(struct hashentry)*(unsigned)(ttblsize+rehash));
--- 298,303 ----
***************
*** 824,827 ****
--- 831,837 ----
#endif
}
}
+
+
+