4.10 Corrigés des exercices
}
sortie << "(" << it ->x <<
return sortie ;
Il
Il
<< i t ->y <<
Il ) " ;
class Phutball {
public :
char damier [Taille ] [Taille ];
Intersection balle ;
Phutball () {
in i t ();
}
void 1n1 t () {
}
fo r (int i = O; i < Taille ; i++)
for (int j = O; j < Taille ; j++)
damier [i] [j ] = '+';
damier [Taille / 2] [Taille
2] = '@ ' ;
balle . x = Taille / 2;
balle . y = Taille / 2;
void joue (Coup & c) {
}
list:: iterator it = c. l. begin ();
if ( c. 1 . si ze ( ) == 1)
damier [it- >x ] [it ->y ] = 'O' ;
else {
}
list:: iterator precedent ;
while ( true ) {
}
precedent = i t;
i t ++;
if ( i t == c . 1 . end ())
break ;
damier [precedent ->x ] [precedent ->y ] = '+';
if (precedent -> l egale ()) {
}
damier [ precedent ->x ] [ precedent ->y ] = '@' ;
balle = * precedent ;
bool gagne (int joueur , Intersection inter ) {
i f (( ( j o u e u r == Jo u e u r D r o i t ) && ( i n t e r . x < 0 ) ) 1 1
(( joueur == Joue u r Droit ) && i n te r . 1ega1 e ( ) &&
( i n t e r . x == 0 ) ) 1 1
73
}
sortie << "(" << it ->x <<
return sortie ;
Il
Il
<< i t ->y <<
Il ) " ;
class Phutball {
public :
char damier [Taille ] [Taille ];
Intersection balle ;
Phutball () {
in i t ();
}
void 1n1 t () {
}
fo r (int i = O; i < Taille ; i++)
for (int j = O; j < Taille ; j++)
damier [i] [j ] = '+';
damier [Taille / 2] [Taille
2] = '@ ' ;
balle . x = Taille / 2;
balle . y = Taille / 2;
void joue (Coup & c) {
}
list
if ( c. 1 . si ze ( ) == 1)
damier [it- >x ] [it ->y ] = 'O' ;
else {
}
list
while ( true ) {
}
precedent = i t;
i t ++;
if ( i t == c . 1 . end ())
break ;
damier [precedent ->x ] [precedent ->y ] = '+';
if (precedent -> l egale ()) {
}
damier [ precedent ->x ] [ precedent ->y ] = '@' ;
balle = * precedent ;
bool gagne (int joueur , Intersection inter ) {
i f (( ( j o u e u r == Jo u e u r D r o i t ) && ( i n t e r . x < 0 ) ) 1 1
(( joueur == Joue u r Droit ) && i n te r . 1ega1 e ( ) &&
( i n t e r . x == 0 ) ) 1 1
73
