@@ -5188,24 +5188,23 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
51885188 }
51895189 // start new game of life
51905190 if ((SEGENV.call == 0 || generation == 0 ) && SEGENV.step < strip.now ) {
5191- SEGENV.step = strip.now + 1500 ; // show initial state for 1.5 seconds
5191+ SEGENV.step = strip.now + 1250 ; // show initial state for 1.25 seconds
51925192 generation = 1 ;
51935193 random16_set_seed (strip.now >>2 ); // seed the random generator
51945194 // Setup Grid
51955195 for (int x = 0 ; x < cols; x++) for (int y = 0 ; y < rows; y++) {
5196- uint8_t state = (random8 () < 82 ) ? 1 : 0 ; // ~32% chance of being alive
5197- if (state == 0 ) {
5198- setBitValue (cells, y * cols + x, false );
5199- setBitValue (futureCells, y * cols + x, false );
5200- if (SEGMENT.check2 ) continue ;
5201- SEGMENT.setPixelColorXY (x,y, !SEGMENT.check1 ?bgColor : RGBW32 (bgColor.r , bgColor.g , bgColor.b , 0 ));
5202- }
5203- else {
5196+ if (random8 () < 82 ) { // ~32% chance of being alive
52045197 setBitValue (cells, y * cols + x, true );
52055198 setBitValue (futureCells, y * cols + x, true );
52065199 color = SEGMENT.color_from_palette (random8 (), false , PALETTE_SOLID_WRAP, 0 );
52075200 SEGMENT.setPixelColorXY (x,y,!SEGMENT.check1 ?color : RGBW32 (color.r , color.g , color.b , 0 ));
52085201 }
5202+ else {
5203+ setBitValue (cells, y * cols + x, false );
5204+ setBitValue (futureCells, y * cols + x, false );
5205+ if (SEGMENT.check2 ) continue ; // overlay
5206+ SEGMENT.setPixelColorXY (x,y, !SEGMENT.check1 ?bgColor : RGBW32 (bgColor.r , bgColor.g , bgColor.b , 0 ));
5207+ }
52095208 }
52105209
52115210 // Clear CRCs
@@ -5250,7 +5249,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52505249
52515250 for (int i = -1 ; i <= 1 ; i++) for (int j = -1 ; j <= 1 ; j++) { // iterate through 3*3 matrix
52525251 if (i==0 && j==0 ) continue ; // ignore itself
5253- if (!SEGMENT.check3 || generation % 1500 == 0 ) { // no wrap disable wrap every 1500 generations to prevent undetected repeats
5252+ if (!SEGMENT.check3 || generation % 1500 == 0 ) { // no wrap, disable wrap every 1500 generations to prevent undetected repeats
52545253 cX = x+i;
52555254 cY = y+j;
52565255 if (cX < 0 || cY < 0 || cX >= cols || cY >= rows) continue ; // skip if out of bounds
@@ -5265,7 +5264,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52655264 if (!getBitValue (futureCells, cIndex)) continue ; // parent just died, color lost
52665265 color = SEGMENT.getPixelColorXY (cX, cY);
52675266 if (color == bgColor) continue ;
5268- nColors[colorCount% 3 ] = color;
5267+ nColors[colorCount % 3 ] = color;
52695268 colorCount++;
52705269 }
52715270 }
@@ -5292,8 +5291,8 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52925291 else dominantColor = nColors[random8 ()%3 ];
52935292 }
52945293 else if (colorCount == 2 ) dominantColor = nColors[random8 ()%2 ]; // 1 leading parent died
5295- else if (colorCount == 1 ) dominantColor = nColors[0 ]; // 2 leading parents died
5296- else dominantColor = color; // all parents died last used color
5294+ else if (colorCount == 1 ) dominantColor = nColors[0 ]; // 2 leading parents died
5295+ else dominantColor = color; // all parents died last used color
52975296 // mutate color chance
52985297 if (random8 () < SEGMENT.intensity || dominantColor == bgColor) dominantColor = !SEGMENT.check1 ?SEGMENT.color_from_palette (random8 (), false , PALETTE_SOLID_WRAP, 0 ): random16 ()*random16 ();
52995298 if (SEGMENT.check1 ) dominantColor = RGBW32 (dominantColor.r , dominantColor.g , dominantColor.b , 0 ); // WLEDMM support all colors
@@ -5312,7 +5311,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
53125311 bool repetition = false ;
53135312 if (!cellChanged || crc == *oscillatorCRC || crc == *spaceshipCRC) repetition = true ; // check if cell changed this gen and compare previous stored crc values
53145313 if (repetition) {
5315- generation = 0 ; // reset on next call
5314+ generation = 0 ; // reset on next call
53165315 SEGENV.step += 1000 ; // pause final generation for 1 second
53175316 return FRAMETIME;
53185317 }
@@ -5324,7 +5323,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
53245323 SEGENV.step = strip.now ;
53255324 return FRAMETIME;
53265325} // mode_2Dgameoflife()
5327- static const char _data_FX_MODE_2DGAMEOFLIFE[] PROGMEM = " Game Of Life@!,Color Mutation ☾,Blur ☾,,,All Colors ☾,Overlay ☾,Wrap ☾,;!,!;!;2;sx=200,ix=12,c1=0 ,o3=1" ;
5326+ static const char _data_FX_MODE_2DGAMEOFLIFE[] PROGMEM = " Game Of Life@!,Color Mutation ☾,Blur ☾,,,All Colors ☾,Overlay ☾,Wrap ☾,;!,!;!;2;sx=200,ix=12,c1=8 ,o3=1" ;
53285327
53295328// ///////////////////////
53305329// 2D Hiphotic //
0 commit comments