fct initialiserPlateau Dames
This commit is contained in:
parent
b6d6878fe3
commit
e241294882
2 changed files with 18 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
|||
#include "../includes/Dames.hpp"
|
||||
|
||||
Dames::Dames(Joueur &j1, Joueur & j2) : joueur1{j1}, joueur2{j2}, joueurCourrant{j1} {
|
||||
Plateau p(10);
|
||||
this->plateau = p;
|
||||
plateau.initialiserPlateau(j1, j2);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,22 @@ const Plateau &Plateau::operator=(const Plateau &src) {
|
|||
}
|
||||
|
||||
void Plateau::initialiserPlateau(Joueur &j1, Joueur &j2) {
|
||||
|
||||
for(int i=0; i<4;i++){
|
||||
for(int j=0; j<10;j++){
|
||||
if((i%2==0 && j%2==1) || (i%2==1 && j%2==0)){
|
||||
plateau[i][j] = new PieceDames("noire");
|
||||
j1.ajoutPiece(plateau[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i=6; i<10;i++){
|
||||
for(int j=0; j<10;j++){
|
||||
if((i%2==0 && j%2==1) || (i%2==1 && j%2==0)){
|
||||
plateau[i][j] = new PieceDames("blanche");
|
||||
j2.ajoutPiece(plateau[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Plateau::afficherPlateau() {}
|
||||
|
|
Reference in a new issue