5.9 Corrigés des exercices
5.9.4 UCT
Go go ;
int nbPlayouts = 5000;
class Noeud {
public :
fl oat sommeScore [Taille + 2] [Taille + 2];
int nbPlayoutsCoup [Taille + 2] [Taille + 2];
unsigned long long hash ;
int abscisse , ordonnee ;
Noeud * fils [Taille + 2] [Taille + 2] ;
void in i t () {
abscisse = O;
ordonnee = 0;
}
for ( i n t i = 0 ; i <= T a i 11 e ; i + +)
for ( i n t j = 0 ; j <= T a i li e ; j + +) {
sommeScore [ i ] [ j ] = 0;
nbPlayoutsCoup [ i] [ j] = 0;
fi ls [i] [j ] =N ULL ;
}
fl oat moyenne (int i, int j) {
}
if (nbPlayoutsCoup [i] [j ] -- 0)
return 0.0;
return sommeScore [ i] [ j] I nbPlayoutsCoup [ i] [ j];
int nbPlayouts () {
int nb = O;
}
for ( i n t i = 0 ;
<= T a i 11 e ; i + +)
for (int j = O; j <= Taille ; j++)
n b += n b P 1 a y ou t s Coup [ i ] [ j ] ;
return nb ;
void descente (Go & goban , int couleur );
} ;
const int MaxNoeud = 100000;
int nbNoeuds = MaxNoeud ;
Noeud pileNoeud [MaxNoeud ];
111
5.9.4 UCT
Go go ;
int nbPlayouts = 5000;
class Noeud {
public :
fl oat sommeScore [Taille + 2] [Taille + 2];
int nbPlayoutsCoup [Taille + 2] [Taille + 2];
unsigned long long hash ;
int abscisse , ordonnee ;
Noeud * fils [Taille + 2] [Taille + 2] ;
void in i t () {
abscisse = O;
ordonnee = 0;
}
for ( i n t i = 0 ; i <= T a i 11 e ; i + +)
for ( i n t j = 0 ; j <= T a i li e ; j + +) {
sommeScore [ i ] [ j ] = 0;
nbPlayoutsCoup [ i] [ j] = 0;
fi ls [i] [j ] =N ULL ;
}
fl oat moyenne (int i, int j) {
}
if (nbPlayoutsCoup [i] [j ] -- 0)
return 0.0;
return sommeScore [ i] [ j] I nbPlayoutsCoup [ i] [ j];
int nbPlayouts () {
int nb = O;
}
for ( i n t i = 0 ;
<= T a i 11 e ; i + +)
for (int j = O; j <= Taille ; j++)
n b += n b P 1 a y ou t s Coup [ i ] [ j ] ;
return nb ;
void descente (Go & goban , int couleur );
} ;
const int MaxNoeud = 100000;
int nbNoeuds = MaxNoeud ;
Noeud pileNoeud [MaxNoeud ];
111
