116
Recherche arborescente Monte-Carlo
void clear () {
}
} ;
for ( int i= O; i < TailleTable + l; i++)
table [i]. clear ();
Table table ;
const int MaxNoeud = 100000;
int nbNoeuds = MaxNoeud ;
Noeud pileNoeud [MaxNoeud ];
Noeud racine ;
int nmoy = 0, npere = 0, nfils = O;
bool pasDeTranspo = false ;
void Noeud :: descente (Go & goban , int couleur ) {
int autre =N oir ;
i f ( c o u 1 e u r == Noir )
autre = Blanc ;
if (( goban . nbCoupsJoues >= MaxCoups) 11
go ban . gameOver ()) {
goban . calcule Scores ();
return ;
}
while (ordonnee != Taille + l) {
Intersection inter (abscisse , ordonnee );
abscisse + +;
i f ( a b s c i s s e -- T a i li e + 1 ) {
abscisse = l;
ordonnee++;
}
if (goban . coupLegal (inter , couleur ) &&
!goban . oeil (inter , couleur )) {
goban .joue (inter , couleur );
Noeud * n = table . present (goban.hash );
if ( pasDeTranspo )
n = NULL ;
i f ( n == NULL) {
nbNoeuds --;
n = &p ileNoeud [ nbNoeuds ];
n->i nit ();
n->hash = goban .hash ;
Précédent

- 130/256

Suivant