114
Recherche arborescente Monte-Carlo
int abscisse , ordonnee ;
Noeud * fils [Taille + 2) [Taille + 2] ;
void init () {
abscisse = O;
ordonnee = O;
}
for ( i n t i = 0 ; i <= T a i li e ; i + +)
for ( in t j = 0; j <= Tai li e ; j ++) {
sommeScore [ i ] [ j ] = 0;
nbPlayoutsCoup [ i] [ j] = 0;
fils [i) [j ) = NULL ;
}
fl oat moyenne ( int profondeur) {
int nb = 0;
}
fi o a t somme = 0 . 0 ;
for ( i n t i = 0 ; i <= T a i li e ; i + +)
for ( i n t j = 0 ; j <= T a i li e ; j + +)
i f ( p ro fo n d e u r == 0 ) {
}
n b += n b P 1 a y o u t s Cou p [ i ] [ j ] ;
somme += sommeScore [ i ] [ j ] ;
else {
}
if (fils [i] [j ] != NULL) {
int nbPlayoutFils =
}
fils [i] [j)->nbPlayouts (profondeur - 1);
n b += n b P 1 a y o u t Fi 1 s ;
somme += n b P 1 a y ou t Fi 1 s * ( 1 . 0 -
fils [i] [j)->moyenne (profondeur - 1));
if ( nb == 0)
return 0.0;
return somme / nb ;
float moyenne ( int i, int j, int profondeur) {
if (profondeur == 0) {
}
if ( nbPiayoutsCoup [ i] [ j] == 0)
return 0.0;
return sommeScore [i] [j ) / nbPlayoutsCoup [i] [j ];
else if (fils [i] [j ) != NULL )
return 1.0 - fi 1 s [ i] [ j ]->moyenne (profondeur - 1);
else {
i f ( n b P 1 a y outs Coup [ i ] [ j ] == 0)
Précédent

- 128/256

Suivant