diff --git a/PoC/life/life.ino b/PoC/life/life.ino index 0ae7794..0a41022 100644 --- a/PoC/life/life.ino +++ b/PoC/life/life.ino @@ -13,16 +13,16 @@ #define C A2 RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false); -// number of windows in a row (e.g. 12) -#define MAXX 4 -// number of stories, eg 8 -#define MAXY 5 +// number of cells in a row (e.g. 12) +#define MAXX 8 +// number of rows, eg 8 +#define MAXY 7 int lifearray[MAXX][MAXY]; void setup() { matrix.begin(); - + Serial.begin(9600); //myWindows(random(1,21)); int window = 13; int brightness = 255; @@ -34,34 +34,59 @@ for(int y=0;y 1,0 // X => 0,1 // XXX => 0-2,2 -int p[]={1,0,0,1,0,2,1,2,2,2,-1}; - +// glider + int p[]={1,0,0,1,0,2,1,2,2,2,-1}; +// block +// int p[]={1,2,2,2,2,1,1,1,-1}; +// flipper +// int p[]={1,2,2,2,3,2,-1}; +// pento1000 +// X +// XXX +// X +// int p[]={0,0,1,0,1,1,1,2,2,1,-1}; + + int n=0; while (p[n]!=-1) { lifearray[p[n]][p[n+1]]=1; + myWindows(xyToWindow(p[n],p[n+1]), brightness, red, green, blue); n+=2; } + +delay(2000); int x=0; int y=0; while ( true ) { + delay(100); + int lifebuf[MAXX][MAXY]; + + for(int j=0;j3) { + y=0; + patternSwitcher++; + } + } + + break; + case 9: + x=y=0;patternSwitcher++; + case 10: for(x=0;x<4;x++) - myWindows(xyToWindow(x,y), brightness, red, green, blue); - if(y++>3) { - y=0; - patternSwitcher++; - } - } + for(y=0;y<5;y++) + myWindows(xyToWindow(x,y), brightness, red, green, blue); + patternSwitcher++; + break; + default: patternSwitcher=0; break;