#include "../includes/Plateau.hpp" #include "../includes/PieceDames.hpp" Plateau::Plateau(int t) { // Création du plateau vide plateau = new Piece **[t]; for (int i = 0; i < t; i++) { plateau[i] = new Piece *[t]; for (int j = 0; j < t; j++) { plateau[i][j] = nullptr; } } } Plateau::~Plateau() { for (int i = 0; i < taille; i++) { delete[] plateau[i]; } delete[] plateau; } Plateau::Plateau(const Plateau &) {} const Plateau &Plateau::operator=(const Plateau &src) { if (this == &src) { return *this; } return *this; } 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() {} void Plateau::modifierPlateau(int x, int y, Piece *piece) { if (x >= 0 && x < taille && y >= 0 && y < taille) { plateau[x][y] = piece; } else { throw std::invalid_argument("Coordonnées invalides"); } }