The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

386193 (5) [Avatar] Offline
I completed the "Get Programming with Go" Chap 20 capstone Game of LIfe in Go with full test coverage:
Nathan Youngman (56) [Avatar] Offline
Hey Doug,

Thanks for posting your solution, and for writing tests too. I like how you put comment headers in the tests to show what the grid looks like.

One suggestion I have is just an optimization to not be allocating things like width, height, and the neighbours array on each iteration -- it's unnecessary work. For this size of grid it hardly matters, it's just a thought.

The solution in the appendix uses package level constants, but you could also make Universe a structure containing width, height, and the array/slice -- that is, if you've already looked at pointers.