194
}
};
}
Méthodes de Monte-Carlo pour le s jeux à un joueur
int move = ( int) (2 * (rand () / (RAND_MAX + 1. 0)));
play Move ( move );
return score;
int scoreBestRollout [MaxLevel ];
int bestRollout [MaxLevel ] [101);
int nestedMoves [MaxLevel ] [101);
bool recallBestSequence = false;
int nestedRollout (Problem & pb , int n) {
int bestScore , scoreRollout;
int bestMove;
scoreBestRollout [n] = O;
white ( true) {
if ( pb . 1 e a f ())
break;
bestScore = -1;
if ( recallBestSequence ) {
}
bestScore = scoreBestRollout [n];
bestMove = bestR ollout [n] [pb.d];
for (int i = O; i < 2; i++) {
if (n ==l ){
Problem p = pb;
p. playMove ( i) ;
p. playout ();
if (p. score > bestScore ) {
bestScore = p. score;
bestMove = i ;
}
if ( recallBestSequence ) {
}
scoreBestRollout [n] = bestScore;
for (int j = O; j < p.depth; j++)
bestRollout [n] [j ) =p . variation [j ];
else if (p. score == bestScore ) {
in t move = (int) (2 * (rand () /
(RAND_MAX + 1 . 0))) ;
if ( move == 1) {
bestScore = p. score;
bestMove = i ;
}
if ( recallBestSequence ) {
}
};
}
Méthodes de Monte-Carlo pour le s jeux à un joueur
int move = ( int) (2 * (rand () / (RAND_MAX + 1. 0)));
play Move ( move );
return score;
int scoreBestRollout [MaxLevel ];
int bestRollout [MaxLevel ] [101);
int nestedMoves [MaxLevel ] [101);
bool recallBestSequence = false;
int nestedRollout (Problem & pb , int n) {
int bestScore , scoreRollout;
int bestMove;
scoreBestRollout [n] = O;
white ( true) {
if ( pb . 1 e a f ())
break;
bestScore = -1;
if ( recallBestSequence ) {
}
bestScore = scoreBestRollout [n];
bestMove = bestR ollout [n] [pb.d];
for (int i = O; i < 2; i++) {
if (n ==l ){
Problem p = pb;
p. playMove ( i) ;
p. playout ();
if (p. score > bestScore ) {
bestScore = p. score;
bestMove = i ;
}
if ( recallBestSequence ) {
}
scoreBestRollout [n] = bestScore;
for (int j = O; j < p.depth; j++)
bestRollout [n] [j ) =p . variation [j ];
else if (p. score == bestScore ) {
in t move = (int) (2 * (rand () /
(RAND_MAX + 1 . 0))) ;
if ( move == 1) {
bestScore = p. score;
bestMove = i ;
}
if ( recallBestSequence ) {
