Go Down

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

|systemx

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 pm Last 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 pm Last Edit: Jul 10, 2009, 01:57 pm by SystemX Reason: 1
OK thank you very much.
I tried it and it works  :D, I will post a link to a video on youtube very soon.

Thanks again for the fast reply.

|systemx

So here it is working : http://www.youtube.com/watch?v=6DQAn-Rqhpw
Thanks again for the help.

Andrew

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

Andrew

Go Up