@@ -5234,6 +5234,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52345234 return FRAMETIME;
52355235 }
52365236
5237+ int aliveCount = 0 ; // Solo glider detection
52375238 bool blurDead = SEGENV.step > strip.now && blur && !bgBlendMode && !overlayBG;
52385239 bool palChanged = SEGMENT.palette != *prevPalette && !allColors;
52395240 if (palChanged) *prevPalette = SEGMENT.palette ;
@@ -5243,6 +5244,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52435244 for (int x = 0 ; x < cols; x++) for (int y = 0 ; y < rows; y++) {
52445245 cIndex = y * cols + x;
52455246 bool alive = getBitValue (cells, cIndex);
5247+ if (alive) aliveCount++;
52465248 CRGB color = SEGMENT.getPixelColorXY (x,y);
52475249 if (palChanged && alive) SEGMENT.setPixelColorXY (x,y, SEGMENT.color_from_palette (random8 (), false , PALETTE_SOLID_WRAP, 0 )); // Recolor alive cells
52485250 else if (overlayBG & alive) SEGMENT.setPixelColorXY (x,y, allColors ? RGBW32 (color.r , color.g , color.b , 0 ) : color); // Redraw alive cells for overlayBG
@@ -5266,7 +5268,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52665268
52675269 for (int i = -1 ; i <= 1 ; i++) for (int j = -1 ; j <= 1 ; j++) { // iterate through 3*3 matrix
52685270 if (i == 0 && j == 0 ) continue ; // ignore itself
5269- if (!wrap || generation % 1500 == 0 ) { // no wrap, disable wrap every 1500 generations to prevent undetected repeats
5271+ if (!wrap || generation % 1500 == 0 || aliveCount == 5 ) { // no wrap, disable wrap every 1500 generations to prevent undetected repeats
52705272 cX = x + i;
52715273 cY = y + j;
52725274 if (cX < 0 || cY < 0 || cX >= cols || cY >= rows) continue ; // skip if out of bounds
@@ -5278,9 +5280,8 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52785280 // count neighbors and store upto 3 neighbor colors
52795281 if (getBitValue (cells, cIndex)) { // if alive
52805282 neighbors++;
5281- if (!getBitValue (futureCells, cIndex)) continue ; // parent just died, color lost
5283+ if (!getBitValue (futureCells, cIndex) || SEGMENT. getPixelColorXY (cX,cY) == bgColor ) continue ; // parent just died, color lost
52825284 color = SEGMENT.getPixelColorXY (cX, cY);
5283- if (color == bgColor) continue ;
52845285 nColors[colorCount % 3 ] = color;
52855286 colorCount++;
52865287 }
0 commit comments