diff --git a/src/Automate.cpp b/src/Automate.cpp index b426cd4f3ee4eb90b87311b4ce1026127919161b..9b6636fbad800197c65db5e3611531711e46acb7 100644 --- a/src/Automate.cpp +++ b/src/Automate.cpp @@ -12,7 +12,7 @@ void Automate::nextTimer() { for(size_t j = 0; j < l; ++j) { Voisinage voisinage(&(*(--buffer.end())).getReseau()[i][j]); regleVoisinage->calculVoisinage(voisinage, *(--buffer.end())); - const Etat e = fonction->getEtatSuivant(voisinage, r.getReseau()[i][j]); + const Etat e = fonction->getEtatSuivant(voisinage, (*(--buffer.end())).getReseau()[i][j]); while(r.getReseau()[i][j].getIndEtat() != e.getIndice()) r.getReseau()[i][j].incrementerEtat(); } diff --git a/src/autocell.cpp b/src/autocell.cpp index 1a2420f661d35d586e19895cda656fbbd8039c30..5d9a0c99a7b03764abc87ed70b569181fd1e2a62 100644 --- a/src/autocell.cpp +++ b/src/autocell.cpp @@ -336,6 +336,9 @@ void AutoCell::modifierCellule(const QModelIndex& index) { grid->item(i,j)->setText(str_indice); //réitnitialiser l'automate ou modif du buffer d + Automate::getInstance().reset(); + Automate::getInstance().setReseauInit(*Grille); + Automate::getInstance().initialiserBuffer(); } void AutoCell::sauvegarderGrille(){ diff --git a/src/voisinage.cpp b/src/voisinage.cpp index 8a3e3f11e04b3e36d654d0773a720c1e7ea35517..a6d087d3b6583bb3348a26c482dbf3105158a291 100644 --- a/src/voisinage.cpp +++ b/src/voisinage.cpp @@ -20,7 +20,7 @@ void RegleVoisinageNeumann::calculVoisinage(Voisinage& v, const Reseau& r) const int y = (cellX+j)%largeur; if (y < 0) y = hauteur + y; - v.voisinage.push_back(new Cellule(r.getReseau()[x][y])); + v.voisinage.push_back(new Cellule(r.getReseau()[y][x])); } } @@ -41,7 +41,7 @@ void RegleVoisinageMoore::calculVoisinage(Voisinage& v, const Reseau& r) const { int y = (cellX+j)%largeur; if (y < 0) y = hauteur + y; - v.voisinage.push_back(new Cellule(r.getReseau()[x][y])); + v.voisinage.push_back(new Cellule(r.getReseau()[y][x])); } }