diff --git a/includes/Dames.hpp b/includes/Dames.hpp index 7401ab6..b4b5bfc 100644 --- a/includes/Dames.hpp +++ b/includes/Dames.hpp @@ -3,8 +3,8 @@ #include -#include "../includes/Plateau.hpp" #include "../includes/Joueur.hpp" +#include "../includes/Plateau.hpp" class Dames { friend std::ostream &operator<<(std::ostream &, const Dames &); @@ -13,19 +13,18 @@ class Dames { Plateau plateau; // Joueurs - Joueur &joueurCourrant; Joueur &joueur1; Joueur &joueur2; + Joueur &joueurCourant; public: - Dames(Joueur &joueur1, Joueur &joueur2); // constructor - virtual ~Dames(); // destructor + Dames(Joueur &joueur1, Joueur &joueur2); // constructor + virtual ~Dames(); // destructor - Dames(const Dames &d); // copy constructor + Dames(const Dames &d); // copy constructor const Dames &operator=(const Dames &); // copy assignement // Fonction d'initialisation du jeu - }; #endif diff --git a/includes/Joueur.hpp b/includes/Joueur.hpp index 06da923..df0fa4c 100644 --- a/includes/Joueur.hpp +++ b/includes/Joueur.hpp @@ -27,9 +27,7 @@ public: void ajoutPiece(Piece *piece) { pieces.push_back(piece); } // Getter pour les pièces du joueur - const std::vector getPieces() const { - return pieces; - } + const std::vector getPieces() const { return pieces; } // Fonction qui supprime une pièce de la liste de pièces du joueur }; diff --git a/includes/Plateau.hpp b/includes/Plateau.hpp index 8a1e33e..d67aae7 100644 --- a/includes/Plateau.hpp +++ b/includes/Plateau.hpp @@ -1,8 +1,8 @@ #ifndef PLATEAU #define PLATEAU -#include "../includes/Piece.hpp" #include "../includes/Joueur.hpp" +#include "../includes/Piece.hpp" #include class Plateau { @@ -23,7 +23,8 @@ public: const Plateau &operator=(const Plateau &); // copy assignement // Fonction pour initialiser le plateau (selon le jeu) - // Seulement deux joueurs pour le jeu de dame uniquement, je suis pas sûre de comment initialiser la fonction autrement + // Seulement deux joueurs pour le jeu de dame uniquement, je suis pas sûre de + // comment initialiser la fonction autrement virtual void initialiserPlateau(Joueur &j1, Joueur &j2); // Fonction pour afficher le plateau (selon le jeu) diff --git a/src/Dames.cpp b/src/Dames.cpp index a62a6ab..15790f1 100644 --- a/src/Dames.cpp +++ b/src/Dames.cpp @@ -1,6 +1,7 @@ #include "../includes/Dames.hpp" -Dames::Dames(Joueur &j1, Joueur & j2) : joueur1{j1}, joueur2{j2}, joueurCourrant{j1} { +Dames::Dames(Joueur &j1, Joueur &j2) + : joueur1{j1}, joueur2{j2}, joueurCourant{j1} { Plateau p(10); this->plateau = p; plateau.initialiserPlateau(j1, j2); @@ -8,7 +9,8 @@ Dames::Dames(Joueur &j1, Joueur & j2) : joueur1{j1}, joueur2{j2}, joueurCourrant Dames::~Dames() {} -Dames::Dames(const Dames &d): joueur1{d.joueur1}, joueur2{d.joueur2}, joueurCourrant{d.joueurCourrant} {} +Dames::Dames(const Dames &d) + : joueur1{d.joueur1}, joueur2{d.joueur2}, joueurCourant{d.joueurCourant} {} const Dames &Dames::operator=(const Dames &src) { if (this == &src) { diff --git a/src/Plateau.cpp b/src/Plateau.cpp index 668e984..5995b5b 100644 --- a/src/Plateau.cpp +++ b/src/Plateau.cpp @@ -1,6 +1,6 @@ #include "../includes/Plateau.hpp" -Plateau::Plateau(){} +Plateau::Plateau() {} Plateau::Plateau(int t) { // Création du plateau vide @@ -31,17 +31,17 @@ 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)){ + 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)){ + 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]); }