46
Minimax, Alpha-Bêta et heuristiques associées
}
if (depth >R+ 1) {
1 i s t vptemp ;
}
int eval = -alphabeta ( depth - 1 - R, -beta , -be ta + 1,
autre , vptemp );
i f ( e v a 1 >= b e ta )
return beta ;
/* fi n des coupes selectives avec coup nul */
list listeCoups = virus . coupsLegaux (joueur );
if (listeCoups .empty ())
return virus . evaluationSiPlusDeCoupsPossibles (joueur );
listeCoups . sort ();
for ( Iist :: iterator it = listeCoups . begin ();
}
i t != listeCoups . end (); ++ i t) {
virus . joue (* it );
1 i s t vptemp ;
int eval = -alpha be ta ( depth - 1, -beta , -alpha , autre ,
vptemp );
if ( eval > alpha) {
alpha = eval ;
}
vp = vptemp ;
vp .push_front (* it );
virus . dejoue (* it );
i f ( a 1 p h a >= be ta ) {
}
scoreHistorique [ it ->nombre ()] += 4 << ( depth * 2);
return beta ;
return alpha ;
2.14.16 Heuristique du coup nul vérifié
int alphabeta ( int depth , int alpha , int beta , char joueur ,
list & vp , bool verify ) {
if ( clock () - clockStart > maxClock )
return O;
if ( depth == 0)
return quiescence (alpha , beta , joueur );
char autre = virus . adversaire (joueur );
int R = 3;
Précédent

- 60/256

Suivant