See the solutions under nbviewer. Or download the .ipynb file here.

I also put a complete example of battleship game online. Have fun :-)