python code for gameoflife