#include "cellule.h" #include #include using namespace std; Cellule::Cellule(): age(0), x(0), y(0), couleur(NOIR) { } Cellule::Cellule(bool etat, unsigned int x, unsigned int y): age(etat ? 1 : 0), x(x), y(y), couleur(etat ? BLEU : NOIR) { } bool Cellule::getVivante() const { return age; } unsigned int Cellule::getX() const { return x; } unsigned int Cellule::getY() const { return y; } Cellule::Couleur Cellule::getCouleur() const { return couleur; } // Accesseurs en écriture void Cellule::setX(unsigned int x) { this->x = x; } void Cellule::setY(unsigned int y) { this->y = y; } bool Cellule::estVoisine(const Cellule &c) const { return age && ((x - c.x) * (x - c.x) + (y - c.y) * (y - c.y) <= 2); } void Cellule::print() const { std::cout<<"("< "<