From a7876503c89855c7167521e98b8151c9fd294bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Leclaire-Fournier?= Date: Mon, 22 Jan 2024 20:16:40 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20le=20remplissage=20altern=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GPA675Lab1GOL/GridTeamH.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/GPA675Lab1GOL/GridTeamH.cpp b/GPA675Lab1GOL/GridTeamH.cpp index cb7a278..f5c16dc 100644 --- a/GPA675Lab1GOL/GridTeamH.cpp +++ b/GPA675Lab1GOL/GridTeamH.cpp @@ -130,15 +130,13 @@ void GridTeamH::fill(CellType value, bool fillBorder) mData[i + (j * mWidth)] = value; } -// TODO: FIX LES COLONNES EN FAISANT ATTENTION AU BORDER -// TIMOTHEE: Je m'en occupe. void GridTeamH::fillAternately(CellType initValue, bool fillBorder) { auto otherValue = (initValue == CellType::alive) ? CellType::dead : CellType::alive; for (size_t i{ static_cast(1) - fillBorder }; i < mWidth - (static_cast(1) - fillBorder); i++) for (size_t j{ static_cast(1) - fillBorder }; j < mHeight - (static_cast(1) - fillBorder); ++j) - mData[i + (j * mWidth)] = !(i % 2) ? initValue : otherValue; + mData[i + (j * mWidth)] = !((i + j) % 2) ? initValue : otherValue; } void GridTeamH::randomize(double percentAlive, bool fillBorder)