\(\(\( (*\ Copyright\ March\ 4, \ 2006\ by\ Doug\ Youvan; \ 
      doug@youvan . com; \ www . pseudocolor . com\ ; \ 
      www . youvan . com\ *) \)\(
\)\( (*\ 
      blue\ super\ bomb; \ 
      xy\ mixing\ chamber\ \ anhililation\ in\ 185\ frames*) \)\(
\)\( (*\ re - centered; \ 
      draws\ outline\ *) \)\(
\)\( (*black/
            gold\ flicker\ for\ super - 
        color\ *) \)\(
\)\(
\)\(\(name = 
        Table[i, {i, 1, 
            200}];\)\(\ \ \)\(
\)\(
\)\(
\)
    \(newsum =. \)\(
\)
    \(ker1sum =. \)\(
\)
    \(gsum =. \)\(
\)\(
\)
    \(newsum = 
        Table[{x, y}, {x, 1, 130}, {y, 1, 102}];\)\(
\)
    \(ker1sum = 
        Table[{x, y}, {x, 1, 130}, {y, 1, 
            102}];\)\(
\)\(
\)
    \(newsum[\([All, All]\)] = {0. , 0. , 0. };\)\(
\)
    \(ker1sum[\([All, All]\)] = {0. , 0. , 
          0. };\)\(
\)\(
\)\( (*\ 
      blue\ bomb\ *) \)\(
\)
    \(newsum[\([42, 30]\)] = {200, 0. , 0. };\)\(
\)
    \(ker1sum[\([42, 30]\)] = {200, 0. , 
          0. };\)\(
\)\(
\)
    \(newsum[\([88, 30]\)] = {0. , 200, 0. };\)\(
\)
    \(ker1sum[\([88, 30]\)] = {0. , 200, 
          0. };\)\(
\)\(
\)
    \(newsum[\([65, 70]\)] = {0. , 0. , 100000};\)\(
\)
    \(ker1sum[\([65, 70]\)] = {0. , 0. , 
          100000};\)\(
\)\(
\)\( (*\ 
      draw\ box\ *) \)\(\ \ \)\( (*rows : \ 40, \ 90; \ columns : \ 28, \ 
      74; \ barrier : \ 63 - 66, 
      50 - 51\ *) \)\(
\)\(
\)
    \( (*\ bottom\ *) \)\(\ \ \)\(For[i = 39, i ≤ 40, \(i++\), 
        For[j = 28, 
          j ≤ 
            75, \(j++\), 
newsum[\([i, j]\)] = {1, 1, 
              1}]];\)\(
\)
    \( (*\ top\ *) \)\(\ \ \)\(For[i = 90, i ≤ 91, \(i++\), 
        For[j = 28, 
          j ≤ 
            75, \(j++\), 
newsum[\([i, j]\)] = {1, 1, 
              1}]];\)\(
\)
    \( (*\ left\ *) \)\(\ \ \)\(For[i = 39, i ≤ 91, \(i++\), 
        For[j = 27, 
          j ≤ 
            28, \(j++\), 
newsum[\([i, j]\)] = {1, 1, 
              1}]];\)\(
\)
    \( (*\ right\ *) \)\(\ \)\(For[i = 39, i ≤ 91, \(i++\), 
        For[j = 74, 
          j ≤ 
            75, \(j++\), 
newsum[\([i, j]\)] = {1, 1, 
              1}]];\)\(
\)\(
\)\( (*\ 
      mixer\ values\ i = 63, i ≤ 66, \ j = 50, 
      j ≤ 51\ *) \)\(
\)\(
\)
    \( (*\ barrier\ bottom\ *) \)\(\ \ \ \)\(For[i = 40, 
        i ≤ 62, \(i++\), 
        For[j = 50, 
          j ≤ 
            51, \(j++\), 
newsum[\([i, j]\)] = {1, 1, 
              1}]];\)\(
\)
    \( (*\ barrier\ top\ *) \)\(\ \ \ \ \)\(For[i = 67, 
        i ≤ 90, \(i++\), 
        For[j = 50, 
          j ≤ 
            51, \(j++\), 
newsum[\([i, j]\)] = {1, 1, 
              1}]];\)\(
\)\(
\)
    \(gsum = 
        Graphics[RasterArray[Apply[RGBColor, newsum, {2}]], 
          AspectRatio -> \ error, \ 
          ImageSize -> {520, 
              408}];\)\(\ \ \)\(
\)\(
\)
    \(Show[gsum];\)\(
\)\(
\)
    \(Export["C:\Documents and Settings\Doug\Desktop\Mathematica\BlueBombShell\0.gif", \ 
        gsum, \ "GIF", 
        ImageSize -> {520, 
            408}];\)\(
\)\(
\)\(
\)\( (*\ reload\ *) \)\(
\)\(
\)
    \(newsum[\([All, All]\)] = {0. , 0. , 0. };\)\(
\)
    \(ker1sum[\([All, All]\)] = {0. , 0. , 
          0. };\)\(
\)\(
\)\( (*\ 
      blue\ bomb\ *) \)\(
\)
    \(newsum[\([42, 30]\)] = {200, 0. , 0. };\)\(
\)
    \(ker1sum[\([42, 30]\)] = {200, 0. , 
          0. };\)\(
\)\(
\)
    \(newsum[\([88, 30]\)] = {0. , 200, 0. };\)\(
\)
    \(ker1sum[\([88, 30]\)] = {0. , 200, 
          0. };\)\(
\)\(
\)
    \(newsum[\([65, 70]\)] = {0. , 0. , 100000};\)\(
\)
    \(ker1sum[\([65, 70]\)] = {0. , 0. , 
          100000};\)\(
\)\(
\)\(
\)\( (*\ 
      evaluate\ entire\ image\ for\ real\ color\ *) \)\(
\)
    \(\ \)\(For[
loop = 1, \ 
      loop ≤ 200, \ \(loop++\), 
If[
        EvenQ[loop], 
For[i = 1, 
          i ≤ 130, \(i++\), 
          For[j = 1, 
            j ≤ 
              102, \(j++\), 
If[\((\((0.  > 
                      newsum[\([i, j, 1]\)])\) || \((newsum[\([i, j, 1]\)] > 
                      1. )\) || 
\((0.  > 
                      newsum[\([i, j, 2]\)])\) || \((newsum[\([i, j, 2]\)] > 
                      1. )\) || 
\((0.  > 
                      newsum[\([i, j, 3]\)])\) || \((newsum[\([i, j, 3]\)] > 
                      1. )\))\), 
\((\ 
                newsum[\([i, j, 1]\)] = 0.25; newsum[\([i, j, 2]\)] = 0.25; 
                newsum[\([i, j, 3]\)] = 0)\)]]], 
For[
          i = 1, i ≤ 130, \(i++\), 
          For[j = 1, 
            j ≤ 
              102, \(j++\), 
If[\((\((0.  > 
                      newsum[\([i, j, 1]\)])\) || \((newsum[\([i, j, 1]\)] > 
                      1. )\) || 
\((0.  > 
                      newsum[\([i, j, 2]\)])\) || \((newsum[\([i, j, 2]\)] > 
                      1. )\) || 
\((0.  > 
                      newsum[\([i, j, 3]\)])\) || \((newsum[\([i, j, 3]\)] > 
                      1. )\))\), 
\((\ 
                newsum[\([i, j, 1]\)] = 0; newsum[\([i, j, 2]\)] = 0; 
                newsum[\([i, j, 3]\)] = 
                  0)\)]]\ ]]; 


 (*\ 
        set\ super - 
          color\ to\ pale\ yellow\ for\ this\ particular\ example\ *) 


      gsum = Graphics[RasterArray[Apply[RGBColor, newsum, {2}]], 
          AspectRatio -> \ error, \ ImageSize -> {520, 408}]; \ \ 

      Show[gsum]; 

Export["C:\Documents and Settings\Doug\Desktop\Mathematica\BlueBombShell\" <> \ 
          ToString[name[\([loop]\)]]\  <> \ ".gif", \ gsum, \ "GIF", 
        ImageSize -> {520, 
            408}]; 

newsum = 
        ker1sum; 

sumr = 0. ; 
sumg = 0. ; 

      sumb = 0. ; 

 (*\ 
        color\ separation\ *) 
sumr = newsum[\([All, \ All, \ 1]\)]; 

      sumg = newsum[\([All, \ All, \ 2]\)]; 

      sumb = newsum[\([All, \ All, 
            3]\)]; 

 (*\ 
        2  x2\ averaging\ left\  = \ 
          rows\ 40 + 0\ or\ 1\ to\ 88 + 0\ or\ 1, \ 
        columns\ 28 + 0\ or\ 1\ to\ 48 + 
          0\ or\ 1*) 

For[i = 20, 
        i ≤ 44, \(i++\), 
        For[j = 14, j ≤ 24, \(j++\), row = 2*i; col = 2*j; 
          summat = 0; 
          summat = \ 
            sumr[\([row, col]\)] + sumr[\([row, col + 1]\)] + 
              sumr[\([row + 1, col]\)] + 
              sumr[\([row + 1, col + 1]\)]; 
sumr[\([row, 
                col]\)] = \(sumr[\([row, 
                  col + 1]\)] = \(sumr[\([row + 1, 
                    col]\)] = \(sumr[\([row + 1, col + 1]\)] = 
                  summat/4\)\)\); 

summat = 0; 
          summat = \ 
            sumg[\([row, col]\)] + sumg[\([row, col + 1]\)] + 
              sumg[\([row + 1, col]\)] + 
              sumg[\([row + 1, col + 1]\)]; 
sumg[\([row, 
                col]\)] = \(sumg[\([row, 
                  col + 1]\)] = \(sumg[\([row + 1, 
                    col]\)] = \(sumg[\([row + 1, col + 1]\)] = 
                  summat/4\)\)\); 

summat = 0; 
          summat = \ 
            sumb[\([row, col]\)] + sumb[\([row, col + 1]\)] + 
              sumb[\([row + 1, col]\)] + 
              sumb[\([row + 1, col + 1]\)]; 
sumb[\([row, 
                col]\)] = \(sumb[\([row, 
                  col + 1]\)] = \(sumb[\([row + 1, 
                    col]\)] = \(sumb[\([row + 1, col + 1]\)] = 
                  summat/4\)\)\);
]]; 


 (*\ 
        staggered\ 2  x\ 2\ left = \ rows\ 40 + 1  or2\ to\ 88 + 1  or2, \ 
        columns\ 28 + 1  or2\ to\ 48 + 
          1  or2*) 

For[i = 20, 
        i ≤ 44, \(i++\), 
        For[j = 14, j ≤ 24, \(j++\), row = 2*i; 
          col = 2*j; 
summat = 0; 
          summat = 
sumr[\([row + 1, col + 1]\)] + 
              sumr[\([row + 1, col + 2]\)] + sumr[\([row + 2, col + 1]\)] + 
              sumr[\([row + 2, col + 2]\)]; 
sumr[\([row + 
                  1, col + 1]\)] = \(sumr[\([row + 1, 
                  col + 2]\)] = \(sumr[\([row + 2, 
                    col + 1]\)] = \(sumr[\([row + 2, col + 2]\)] = 
                  summat/4\)\)\); 

summat = 0; 
          summat = 
sumg[\([row + 1, col + 1]\)] + 
              sumg[\([row + 1, col + 2]\)] + sumg[\([row + 2, col + 1]\)] + 
              sumg[\([row + 2, col + 2]\)]; 
sumg[\([row + 
                  1, col + 1]\)] = \(sumg[\([row + 1, 
                  col + 2]\)] = \(sumg[\([row + 2, 
                    col + 1]\)] = \(sumg[\([row + 2, col + 2]\)] = 
                  summat/4\)\)\); 

summat = 0; 
          summat = 
sumb[\([row + 1, col + 1]\)] + 
              sumb[\([row + 1, col + 2]\)] + sumb[\([row + 2, col + 1]\)] + 
              sumb[\([row + 2, col + 2]\)]; 
sumb[\([row + 
                  1, col + 1]\)] = \(sumb[\([row + 1, 
                  col + 2]\)] = \(sumb[\([row + 2, 
                    col + 1]\)] = \(sumb[\([row + 2, col + 2]\)] = 
                  summat/4\)\)\);

]]; 



 (*\ 2  x2\ averaging\ right = \ rows\ 40 + 0  or1\ to\ 88 + 0  or1, \ 
        columns\ 52 + 0  or1\ to\ 72 + 
          0  or1\ \ *) 


For[i = 20, i ≤ 44, \(i++\), 
        For[j = 26, j ≤ 36, \(j++\), row = 2*i; col = 2*j; 
          summat = 0; 
          summat = \ 
            sumr[\([row, col]\)] + sumr[\([row, col + 1]\)] + 
              sumr[\([row + 1, col]\)] + 
              sumr[\([row + 1, col + 1]\)]; 
sumr[\([row, 
                col]\)] = \(sumr[\([row, 
                  col + 1]\)] = \(sumr[\([row + 1, 
                    col]\)] = \(sumr[\([row + 1, col + 1]\)] = 
                  summat/4\)\)\); 

summat = 0; 
          summat = \ 
            sumg[\([row, col]\)] + sumg[\([row, col + 1]\)] + 
              sumg[\([row + 1, col]\)] + 
              sumg[\([row + 1, col + 1]\)]; 
sumg[\([row, 
                col]\)] = \(sumg[\([row, 
                  col + 1]\)] = \(sumg[\([row + 1, 
                    col]\)] = \(sumg[\([row + 1, col + 1]\)] = 
                  summat/4\)\)\); 

summat = 0; 
          summat = \ 
            sumb[\([row, col]\)] + sumb[\([row, col + 1]\)] + 
              sumb[\([row + 1, col]\)] + 
              sumb[\([row + 1, col + 1]\)]; 
sumb[\([row, 
                col]\)] = \(sumb[\([row, 
                  col + 1]\)] = \(sumb[\([row + 1, 
                    col]\)] = \(sumb[\([row + 1, col + 1]\)] = 
                  summat/4\)\)\);
]]; 


 (*\ 
        staggered\ 2  x\ 2\ right = \ rows\ 40 + 1  or2\ to\ 88 + 1  or2, \ 
        columns\ 50 + 1  or2\ to\ 72 + 
          1  or2\ *) 

For[i = 20, 
        i ≤ 44, \(i++\), 
        For[j = 25, j ≤ 36, \(j++\), row = 2*i; 
          col = 2*j; 
summat = 0; 
          summat = 
sumr[\([row + 1, col + 1]\)] + 
              sumr[\([row + 1, col + 2]\)] + sumr[\([row + 2, col + 1]\)] + 
              sumr[\([row + 2, col + 2]\)]; 
sumr[\([row + 
                  1, col + 1]\)] = \(sumr[\([row + 1, 
                  col + 2]\)] = \(sumr[\([row + 2, 
                    col + 1]\)] = \(sumr[\([row + 2, col + 2]\)] = 
                  summat/4\)\)\); 

summat = 0; 
          summat = 
sumg[\([row + 1, col + 1]\)] + 
              sumg[\([row + 1, col + 2]\)] + sumg[\([row + 2, col + 1]\)] + 
              sumg[\([row + 2, col + 2]\)]; 
sumg[\([row + 
                  1, col + 1]\)] = \(sumg[\([row + 1, 
                  col + 2]\)] = \(sumg[\([row + 2, 
                    col + 1]\)] = \(sumg[\([row + 2, col + 2]\)] = 
                  summat/4\)\)\); 

summat = 0; 
          summat = 
sumb[\([row + 1, col + 1]\)] + 
              sumb[\([row + 1, col + 2]\)] + sumb[\([row + 2, col + 1]\)] + 
              sumb[\([row + 2, col + 2]\)]; 
sumb[\([row + 
                  1, col + 1]\)] = \(sumb[\([row + 1, 
                  col + 2]\)] = \(sumb[\([row + 2, 
                    col + 1]\)] = \(sumb[\([row + 2, col + 2]\)] = 
                  summat/4\)\)\);

]]; 

 (*\ 
        2  x2\ averaging\ left\  = \ 
          rows\ 40 + 0\ or\ 1\ to\ 88 + 0\ or\ 1, \ 
        columns\ 28 + 0\ or\ 1\ to\ 48 + 0\ or\ 1\ *) 
 (*\ 
        staggered\ 2  x\ 2\ left = \ rows\ 40 + 1  or2\ to\ 88 + 1  or2, \ 
        columns\ 28 + 1  or2\ to\ 48 + 1  or2\ *) 
 (*\ 
        2  x2\ averaging\ right = \ rows\ 40 + 0  or1\ to\ 88 + 0  or1, \ 
        columns\ 52 + 0  or1\ to\ 72 + 0  or1\ \ *) 
 (*\ 
        staggered\ 2  x\ 2\ right = \ rows\ 40 + 1  or2\ to\ 88 + 1  or2, \ 
        columns\ 50 + 1  or2\ to\ 72 + 
          1  or2\ *) 
 (*90 - 40 = 50; \ 74 - 28 = 46; \ 
        50\ x\ 46\  = \ 2300; \ 
        230\ seed\ should\ yield\ equilbrium\ of\ gray = 
          0.1\ *) 

 (*rows : \ 40, \ 
        90; \ columns : \ 28, \ 74; \ barrier : \ 50.5; \ 
        aperature : \ 63 - 66, 
        50 - 51\ *) 

 (*\ 
        left\ columns\ end\ at\ 48, 49, 50\ ; \ right\ columns\ end\ at\ 51, 
        52, 53; \ 
        averages\ per\ row\ 3\ pixels\ on\ left\ and\ 3\ pixels\ on\ right\ for\ 8\ rows\ individually\ to\ achieve\ bi - 
          directional\ flow\ *) 

 (*\ 
        This\ works\ with\ no\ inter - 
          row\ averaging\ of\ \(color : 

For[i = 61, 
                i ≤ 
                  68, \(i++\), 
sumr[\([i, 
                      48]\)] = \(sumr[\([i, 
                        49]\)] = \(sumr[\([i, 
                          50]\)] = \(sumr[\([i, 
                            51]\)] = \(sumr[\([i, 
                              52]\)] = \(sumr[\([i, 53]\)] = 
                            sumr[\([i, 48]\)]/6\  + \ sumr[\([i, 49]\)]/6\  + 
                              sumr[\([i, 50]\)]/6 + \ sumr[\([i, 51]\)]/6\  + 
                              sumr[\([i, 52]\)]/6\  + \ 
                              sumr[\([i, 53]\)]/
                                6\)\)\)\)\)]\); 

For[i = 61, 
          i ≤ 
            68, \(i++\), 
sumg[\([i, 
                48]\)] = \(sumg[\([i, 
                  49]\)] = \(sumg[\([i, 
                    50]\)] = \(sumg[\([i, 
                      51]\)] = \(sumg[\([i, 52]\)] = \(sumg[\([i, 53]\)] = 
                      sumg[\([i, 48]\)]/6\  + \ sumg[\([i, 49]\)]/6\  + 
                        sumg[\([i, 50]\)]/6 + \ sumg[\([i, 51]\)]/6\  + 
                        sumg[\([i, 52]\)]/6\  + \ 
                        sumg[\([i, 53]\)]/
                          6\)\)\)\)\)]; 

For[i = 61, 
          i ≤ 
            68, \(i++\), 
sumb[\([i, 
                48]\)] = \(sumb[\([i, 
                  49]\)] = \(sumb[\([i, 
                    50]\)] = \(sumb[\([i, 
                      51]\)] = \(sumb[\([i, 52]\)] = \(sumb[\([i, 53]\)] = 
                      sumb[\([i, 48]\)]/6\  + \ sumb[\([i, 49]\)]/6\  + 
                        sumb[\([i, 50]\)]/6 + \ sumb[\([i, 51]\)]/6\  + 
                        sumb[\([i, 52]\)]/6\  + \ 
                        sumb[\([i, 53]\)]/
                          6\)\)\)\)\)];\ \ *) 

 (*\ \ x, 
        y\ mixing\ chamber\ 

sumrall = 
          0; \ sumgall = 0; sumball = 0; 
        For[i = 61, i ≤ 68, \ \(i++\), 
          For[j = 48, j ≤ 53, \(j++\), \ 
            sumrall = sumrall + sumr[\([i, j]\)]/48; \ 
            sumgall = sumgall + sumg[\([i, j]\)]/48; \ 
            sumball = 
              sumball + 
                sumb[\([i, j]\)]/
                  48]]; 

For[i = 61, 
          i ≤ 68, \ \(i++\), 
          For[j = 48, j ≤ 53, \(j++\), \ 
            sumr[\([i, j]\)] = sumrall; sumg[\([i, j]\)] = \ sumgall; \ 
            sumb[\([i, j]\)] = 
              sumball]];\ \ *) 

 (*\ 
        for\ color\ bombs, \ 
        2  x4\ mixer\ *) 

sumrall = 0; \ 
      sumgall = 0; sumball = 0; 
      For[i = 63, i ≤ 66, \ \(i++\), 
        For[j = 50, j ≤ 51, \(j++\), \ 
          sumrall = sumrall + sumr[\([i, j]\)]/8; \ 
          sumgall = sumgall + sumg[\([i, j]\)]/8; \ 
          sumball = 
            sumball + 
              sumb[\([i, j]\)]/8]]; 

For[
        i = 63, i ≤ 66, \ \(i++\), 
        For[j = 50, j ≤ 51, \(j++\), \ sumr[\([i, j]\)] = sumrall; 
          sumg[\([i, j]\)] = \ sumgall; \ 
          sumb[\([i, j]\)] = 
            sumball]]; 


For[i = 1, i ≤ 130, \(i++\), 
        For[j = 1, 
          j ≤ 
            102, \(j++\), 
newsum[\([i, 
                j]\)] = {sumr[\([i, j]\)], sumg[\([i, j]\)], 
              sumb[\([i, 
                  j]\)]}]]; 


ker1sum = 
        newsum;

]\)\( (*\ 
      end\ of\ big\ loop\ *) \)\)\)\)