VB - Conway's Game of Life - logic for counting neighbors
Posted on 2005-03-31
I don't have the code with me, but I am trying to figure out the code or pseudocode for determing how many neighbors I have in John Conway's - The Game of Life.
I have a grid that is 5 x 5, and an initialize button which places an "X" in random text boxes when clicked. The boxes are in text boxes within a control array. How the heck do I figure out how many neighbors each Text box has? This is driving me crazy?
......and yes, this is a homework assignment, but I am not asking for the program, just some help with the logic for counting the neightbors.
T0 T1 T2 T3 T4
T5 T6 T7 T8 T9
T10 T11 T12 T13 T14
T15 T16 T17 T18 T19
T20 T21 T22 T23 T24
You see, if I'm trying to get the neighbors for T11, it has no idea which Textbox number is around him.....it could be anything. This is where I'm confused.