3.9 Corrigés des exercices
on utilise des valeurs de hachage sur 64 bits.
3.9.5 Classes génériques pour les tables de transposition
int SizeTable = 65535; Il une puissance de 2 moins 1
template
class GenericTranspo {
public :
bool scoreExact ;
short int score ;
unsigned char depth ;
Move best ;
unsigned long long hash ;
} ;
template
class Table {
Transpo * table ;
public :
Table () {
table = new Transpo [ SizeTable + 1];
}
-Table () {delete [] table ;}
Transpo * look (Board * b) {
}
Transpo * trans = & table [b->h ash () & SizeTable ];
if (trans ->h ash == b->hash ())
return trans ;
return NULL ;
bool add (Board * b, unsigned char depth ,
short int score ,
const Move & best , bool scoreExact ) {
Transpo * trans = & table [b->h ash () & SizeTable ];
if ( trans -> depth >= depth )
return fa lse ;
trans ->h ash = b->h ash ();
trans -> s core = score ;
trans -> scoreExact = scoreExact ;
trans -> d epth = depth ;
trans -> b est = best ;
57
Précédent

- 71/256

Suivant