200
}
Méthodes de Monte-Carlo pour le s jeux à un joueur
int column = O;
for (int i = O; i < MaxSize; i++) {
}
if (color [MaxSize * MaxSize - MaxSize + column ]
== 9)
removeColumn ( column );
else
column++;
score += (move. nbLocations
2) *
(move. nbLocations
2);
if (color [MaxSize * MaxSize - MaxSize ] -- 9)
score += 1000;
variation [ 1 en g th V aria t ion ] = move ;
le ngth Va ri a tio n ++;
int bestColor () {
int nbColors [IO];
}
for (inti= O; i < 10; i++)
nbColors [i] = O;
for (int i = O; i < MaxSize * MaxSize; i++)
if (color [i] != 9)
nbColors [ color [ i ]]++;
int best = 0, bestScore = O;
for (int i = O; i < 10; i++)
if (nbColors [i] > bestScore) {
bestScore = nbColors [ i] ;
best = i;
}
return best;
void playou t () {
}
} ;
int tabu = bestColor ();
findMoves (ta bu );
while ( nbMoves > 0) {
}
int index = nbMoves * (rand () / (RAND_MAX+ 1.0));
playMove ( moves [index ]);
fi ndMoves (ta bu );
Problem problem [ MaxProblem ];
}
Méthodes de Monte-Carlo pour le s jeux à un joueur
int column = O;
for (int i = O; i < MaxSize; i++) {
}
if (color [MaxSize * MaxSize - MaxSize + column ]
== 9)
removeColumn ( column );
else
column++;
score += (move. nbLocations
2) *
(move. nbLocations
2);
if (color [MaxSize * MaxSize - MaxSize ] -- 9)
score += 1000;
variation [ 1 en g th V aria t ion ] = move ;
le ngth Va ri a tio n ++;
int bestColor () {
int nbColors [IO];
}
for (inti= O; i < 10; i++)
nbColors [i] = O;
for (int i = O; i < MaxSize * MaxSize; i++)
if (color [i] != 9)
nbColors [ color [ i ]]++;
int best = 0, bestScore = O;
for (int i = O; i < 10; i++)
if (nbColors [i] > bestScore) {
bestScore = nbColors [ i] ;
best = i;
}
return best;
void playou t () {
}
} ;
int tabu = bestColor ();
findMoves (ta bu );
while ( nbMoves > 0) {
}
int index = nbMoves * (rand () / (RAND_MAX+ 1.0));
playMove ( moves [index ]);
fi ndMoves (ta bu );
Problem problem [ MaxProblem ];
