More detailed implementation of battleship example.