2.14 Corrigés des exercices
}
}
vp . push_front (* it );
}
virus . dejoue (* it );
if (alpha >= be ta )
return beta ;
return alpha ;
int approfondissementlteratif ( list & vp ) {
int eval = virus . evaluation ( 'O' );
lis t vpTemp ;
clockStart = clock ();
for (int d = 1;
(clock () - clockStart < maxClock ) &&
( d < ProfondeurMax );
d++) {
39
int evalTemp = alphabeta (d , -Taille * Taille , Taille *
Taille , 'O' , vpTemp );
if ( clock ()
clockStart < maxClock ) {
eval = evalTemp ;
vp = vpTemp ;
}
}
return eval ;
}
int main () {
list listeCoups ;
while ( true ) {
cout << virus ;
listeCoups = virus . coupsLegaux ( '@' );
if (listeCoups .empty {))
break ;
cout << "Donnez.... ., votre.... ., coup._.:._." ;
Coup coup ;
coup . couleur = '@' ;
do {
cin >> coup .x >> coup .y;
} while (! virus . coupLegal (coup));
virus . joue (coup );
cout << virus ;
listeCoups = virus . coupsLegaux ( 'O' );
if (listeCoups .empty ())
break ;
list vp ;
int eval = approfondissementlteratif (vp);
Précédent

- 53/256

Suivant