Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
Your getNearCount function works just perfect! The only problem i see here is the way nextGeneration() was designed. In short it reads and writes data at the same time (in the same loop), so for example in the first generation when your loop reaches (15,9) value of nearCells equals 3 and (line 88) condition is triggered [(15,9) gets spawned], which also trigger spawn of (16,9). By the time your loop reaches (15,10) there is already 4 near living cells. I suggest you to create 2 loops with accessor (get) functions and mutator funcs respectively
28th Mar 2019, 7:01 PM
pascal
pascal - avatar
0
You are welcome. Your program seems quite entertaining.
28th Mar 2019, 7:15 PM
pascal
pascal - avatar