Pages: [1]   Go Down
Author Topic: Help with game of life on 8*10 LED matrix  (Read 490 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
ME LIKE ARDUINO :p
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: July 10, 2009, 06:05:20 am by Andrew » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
ME LIKE ARDUINO :p
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK thank you very much.
I tried it and it works  smiley-grin, I will post a link to a video on youtube very soon.

Thanks again for the fast reply.
« Last Edit: July 10, 2009, 06:57:27 am by SystemX » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
ME LIKE ARDUINO :p
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So here it is working :
Thanks again for the help.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You've made a neat job of that, very nice. I wish my hardware skills matched my software.

Andrew
Logged

Pages: [1]   Go Up
Jump to: