Battleship in Python. Implementing Dynamic Programming