We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5d0627a + 4feb9e7 commit 027a9a6Copy full SHA for 027a9a6
gameoflife/src/index.js
@@ -188,7 +188,7 @@ class Main extends React.Component {
188
if (j > 0) if (g[i][j - 1]) count++;
189
if (i < this.rows - 1) if (g[i + 1][j]) count++;
190
if (i < this.rows - 1 && j > 0) if (g[i + 1][j - 1]) count++;
191
- if (i < this.rows - 1 && this.cols - 1) if (g[i + 1][j + 1]) count++;
+ if (i < this.rows - 1 && j < this.cols - 1) if (g[i + 1][j + 1]) count++;
192
if (g[i][j] && (count < 2 || count > 3)) g2[i][j] = false;
193
if (!g[i][j] && count === 3) g2[i][j] = true;
194
}
0 commit comments