Go Down

### Topic: Help with game of life on 8*10 LED matrix (Read 806 times)previous topic - next topic

#### SystemX

##### Jul 10, 2009, 11:47 am
Hi,
I have made a 8*10 LED matrix and I wanted to run game of life on it.
I have tried to use the code from Direct driving of an 8x8 LED matrix by Andrew. I have done all of the needed changes for it to work, but I got stock in this part:
This is the part that deals with the 4 rules. and SIZE = 8
but I have 2 sizes 10 and 8, and I don't know where to put what.
int neighbours(int x, int y) {
return world[(x + 1) % SIZE][y][0] +
world
• [(y + 1) % SIZE][0] +
world[(x + SIZE - 1) % SIZE][y][0] +
world
• [(y + SIZE - 1) % SIZE][0] +
world[(x + 1) % SIZE][(y + 1) % SIZE][0] +
world[(x + SIZE - 1) % SIZE][(y + 1) % SIZE][0] +
world[(x + SIZE - 1) % SIZE][(y + SIZE - 1) % SIZE][0] +
world[(x + 1) % SIZE][(y + SIZE - 1) % SIZE][0];
}

So if some one can help me with that I would be very happy.
Thanks.

#### Andrew

#1
##### Jul 10, 2009, 01:04 pmLast Edit: Jul 10, 2009, 01:05 pm by Andrew Reason: 1
Off the top of my head - define two different size constants, XSIZE and YSIZE. Then where my code is applying SIZE to "x" replace it with XSIZE and where it's applying size to "y" replace it with YSIZE.

Be sure to post pictures/videos of it working!

Andrew

#### SystemX

#2
##### Jul 10, 2009, 01:52 pmLast Edit: Jul 10, 2009, 01:57 pm by SystemX Reason: 1
OK thank you very much.
I tried it and it works  , I will post a link to a video on youtube very soon.

Thanks again for the fast reply.

#### SystemX

#3
##### Jul 10, 2009, 02:00 pm
So here it is working : http://www.youtube.com/watch?v=6DQAn-Rqhpw
Thanks again for the help.

#### Andrew

#4
##### Jul 10, 2009, 02:07 pm
You've made a neat job of that, very nice. I wish my hardware skills matched my software.

Andrew

Go Up