My code compiles correctly (though with a suspiciously low size reported--400 bytes, when I'm using libraries that should be upwards of 10000 bytes), and uploads fine, but the arduino (a Mega2560) proceeds to do nothing at all, except light its L and TX (and of course power) LEDs.
Please help? I don't understand this in the least. If it helps any, this is supposed to do a simple GoL output on a TV screen.
#include <TVout.h>
#include <video_gen.h>
boolean main[120][96];
int surroundings[120][96];
TVout tv;
void setup()
{
randomSeed(analogRead(0));
for(int x = 0; x < 119; x++)
{
for(int y = 0; y < 95; y++)
{
main[x][y] = random(0, 1);
}
}
tv.begin(NTSC, 120, 96);
}
void loop()
{
for(int x = 0; x < 119; x++)
{
for(int y = 0; y < 95; y++)
{
if(main[x][y] == 1)
{ tv.set_pixel(x, y, WHITE); }
else
{ tv.set_pixel(x, y, BLACK); }
}
}
for(int x = 0; x < 119; x++)
{
for(int y = 0; y < 95; y++)
{
int surr = 0;
int xp; int yp; int xm; int ym;
if(x == 0) {
xp = 1;
xm = 119;
}
else if(x == 119) {
xp = 0;
xm = 118;
}
else {
xp = x + 1;
xm = x - 1;
}
if(y == 0) {
yp = 1;
ym = 95;
}
else if(y == 95) {
yp = 0;
ym = 94;
}
else {
yp = y + 1;
ym = y - 1;
}
surr += main[xp][y];
surr += main[xm][y];
surr += main[xp][yp];
surr += main[xm][yp];
surr += main[xp][ym];
surr += main[xm][ym];
surr += main[x][yp];
surr += main[x][ym];
surroundings[x][y] = surr;
}
}
for(int x = 0; x < 119; x++)
{
for(int y = 0; y < 95; y++)
{
if(surroundings[x][y] == 3)
{ main[x][y] = 1; }
else if(surroundings[x][y] != 2 && surroundings[x][y] != 3)
{ main[x][y] = 0; }
}
}
}