4.10 Corrigés des exercices
}
list & liste ) {
if ( ! elementlntersection ( interBalle , liste )) {
aj outelntersection ( interBalle , liste );
}
for ( in t i = -1 ; i <= 1 ; i + +)
fo r ( i n t j = - 1 ; j <= 1 ; j + +) {
Intersection inter = interBalle ;
i n ter . x += i ;
}
i n te r . y += j ;
if (inter . legale ()) {
}
i f ( damier [ i n te r . x ] [ i n ter . y ] -- '0' ) {
}
while ( true ) {
i n t e r . x += i ;
i n t e r . y += j ;
}
if (! inter . legale () Il
(damier [inter .x] [inter .y] != ' O ' ))
break ;
if (inter . legale () &&
( dam i e r [ i n t e r . x ] [ i n t e r . y ] == ' + ' ) )
intersectionsBalle (inter , liste );
void coupsVoisinsBalle ( int joueur ,
list & listeCoups ) {
list liste ;
intersectionsBalle (balle , liste );
int meilleur , meilleurBalle ;
i f ( j o u e u r == Jo u e u r D r o i t ) {
}
meilleur = Taille ;
meilleurB alle = Taille ;
else {
}
meilleur = -1;
meilleurB alle = -1;
fo r ( list :: iterator it = liste . begin ();
it != liste .end (); ++ it) {
if (damier [it- >x] [it- >y ] == '+') {
i f ( ( ( j o u e u r == Jo u e u r D ro i t ) &&
( it ->x < meilleurBalle )) 11
((joueur == JoueurGauche ) &&
( it ->x > meilleurB alle )))
meilleurBalle = it ->x ;
81
Précédent

- 95/256

Suivant