So I'm trying to create a simple Game of Life app, but I have no idea how I can get the amount of neighbours. I now have a grid of 16x16 actives (300), which you can turn black and white by clicking on them.
Originally Posted by Don Luciano what is game of life?
I don't really understand what do u want. Could you explain it a bit better.
It's a game that basically shows little dots growing off of each other and if any of them get singled out then they eventually die unless more come and reconnect them.
I think you can.. You can also check if a cell is "Occupied"
Here could be another way... Give each cell a detector on each side, and if the detector is overlapping another full cell, then the current cell must have a neighbour.
I already have 300 actives, and I would need 8 detectors per object. So a total of 2400 objects Or you could have only 8 detectors and move those to the position of the cell you want to check.
Or you could go even more complicated and have each live cell as an active object and create more active objects around it when needed, and destroying others when they die.
you can do this just with an array. But it's a lot of coding.
Julian said bout detectors, that's a good way. And you don't need 8 detectors for each cell you need only one. Since the cell dies only when having no neighboirs. So it's a bigger detector surronding the whole object.
Other way is to use alpha channel, and make the same object as the detector itself, just make it a pixel bigger in all directions. Make that border invisible, and check if it overlaps itself. if it doesn't well, u know the deal.
There are actually more rules to the game of life, you can't just check for it having no neighbours you need to know the amount of neighbours. Thanks for all the comments guys, I'm not going to try creating this anymore I'm not ready for it .
I think it's possible, not too tough. Just compare all the adjacent arrays with a mathematical formula.
However, MMF's expression editor system would make this extremely annoying so I'm not going to do it
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.