Camal (16) [Avatar] Offline
I just finished my implementation “Game of Life” in Go. I would love to get some feedback for my written test and approach to it.

Rules :

* A living (`true`) cell with less then 2 living neighbours will die
* A living (`true`) cell with 2 or 3 living neighbours will live
* A dead (`false`) cell with 3 living neighbours will live

I was really lost at line because I was swapping the universes within the function.

Also I really would like a cool animation. The only solution I found was to but this is removing everything, even the prompt.

I was a little messy in the test department but I tried to move my mock into a helper function.

Thanks for any thoughts on this one smilie
Nathan Youngman (56) [Avatar] Offline
Good on you for writing tests -- especially since testing isn't covered in this book.

One thing to watch for is always indexing the universe in the same way. I think this line


should be:


If that's a bug, maybe your tests don't have the right expectations?

One other recommendation is to simplify your Alive method. Try to implement it without using any if statements.

Thanks for posting your solution,