l'algorithme MinMax --> Evaluate() ?
Voilà le programme Minmax tel que j'ai pu le prendre sur http://www.seanet.com/~brucemo/topics/topics.htm
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| int MinMax(int depth)
{
if (SideToMove() == WHITE) // White is the "maximizing" player.
return Max(depth);
else // Black is the "minimizing" player.
return Min(depth);
}
int Max(int depth) // Au tour des BLANCS de jouer
{
int best = -INFINITY;
if (depth <= 0)
return Evaluate();
GenerateLegalMoves();
while (MovesLeft()) {
MakeNextMove();
val = Min(depth - 1);
UnmakeMove();
if (val > best)
best = val;
}
return best;
}
int Min(int depth) // Au tour des NOIRS de jouer
{
int best = INFINITY; // <-- Note that this is different than in "Max".
if (depth <= 0)
return Evaluate();
GenerateLegalMoves();
while (MovesLeft()) {
MakeNextMove();
val = Max(depth - 1);
UnmakeMove();
if (val < best) // <-- Note that this is different than in "Max".
best = val;
}
return best;
} |
GenerateLegalMove()
MakeNextMove()
MovesLeft()
UnmakeMove()
Ces quatres fonctions (bien que je ne vois pas encore commment je vais m'y prendre) semble réalisable
Cependant je n'arrive pas à comprendre à quoi sert la fonction Evaluate() et même si j'ai une petite idée, je ne vois pas comment la réaliser...
Pourriez-vous m'apporter vos lumières ?... :oops: :)