@@ -5210,10 +5210,8 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52105210 cIndex = y * cols + x;
52115211 if (random8 (100 ) < 32 ) { // ~32% chance of being alive
52125212 setBitValue (cells, cIndex, true );
5213- color = SEGMENT.color_from_palette (random8 (), false , PALETTE_SOLID_WRAP, 0 );
5214- SEGMENT.setPixelColorXY (x,y, allColors ? random16 () * random16 () : color);
5213+ SEGMENT.setPixelColorXY (x,y, bgColor); // Initial color set in redraw loop
52155214 }
5216- else if (!overlayBG) SEGMENT.setPixelColorXY (x,y, bgColor); // set background color if not overlaying
52175215 }
52185216 memcpy (futureCells, cells, dataSize);
52195217
@@ -5231,7 +5229,6 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52315229 a = t;
52325230 }
52335231 *gliderLength = cols * rows / a * 4 ;
5234- return FRAMETIME;
52355232 }
52365233
52375234 int aliveCount = 0 ; // Solo glider detection
@@ -5246,6 +5243,15 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52465243 bool alive = getBitValue (cells, cIndex);
52475244 if (alive) aliveCount++;
52485245 uint32_t cellColor = SEGMENT.getPixelColorXY (x,y);
5246+ if (generation == 1 ) {// Spawn initial colors randomly
5247+ bool aliveBgColor = (alive && cellColor == bgColor);
5248+ if (aliveBgColor && !random (12 )) SEGMENT.setPixelColorXY (x,y, allColors ? random16 () * random16 () : SEGMENT.color_from_palette (random8 (), false , PALETTE_SOLID_WRAP, 0 )); // Color alive cell
5249+ else if (alive && !aliveBgColor) SEGMENT.setPixelColorXY (x,y, cellColor); // Redraw alive cells
5250+ else if (!alive && !overlayBG && !bgBlendMode) SEGMENT.setPixelColorXY (x,y, bgColor); // Redraw dead cells for default overlayFG
5251+ else if (!alive && !overlayBG) SEGMENT.setPixelColorXY (x,y, color_blend (cellColor, bgColor, 16 )); // Fade dead cells (bgBlendMode)
5252+ continue ;
5253+ }
5254+
52495255 if ( alive && palChanged) SEGMENT.setPixelColorXY (x,y, SEGMENT.color_from_palette (random8 (), false , PALETTE_SOLID_WRAP, 0 )); // Recolor alive cells
52505256 else if ( alive && overlayBG) SEGMENT.setPixelColorXY (x,y, cellColor); // Redraw alive cells for overlayBG
52515257 if (!alive && palChanged && !overlayBG) SEGMENT.setPixelColorXY (x,y, bgColor); // Remove blurred cells from previous palette
0 commit comments