def verify_empty(self, coords):
     """Verify all coordinates are clear of ships"""
     result = True
     for coord in coords:
         row, col = coord_to_offset(coord)
         # assign location ship to this ship
         if self.grid[row][col].ship:
             result = False
     return result
 def guess(self, coord):
     """Apply guess to board"""
     row, col = coord_to_offset(coord)
     result = self.grid[row][col].guess()
     if result == MISS:
         response = "Guess [{}]: You Missed!\n".format(coord)
     elif result == HIT:
         response = "Guess [{}]: You Hit!!\n".format(coord)
     elif result == SUNK:
         response = "Guess [{}]: You SUNK my {}!!!\n".format(
             coord, self.grid[row][col].ship.name)
     return response
 def place_ship(self, ship):
     """Place Ship on board"""
     for coord in ship.coords:
         row, col = coord_to_offset(coord)
         # assign location ship to this ship
         self.grid[row][col].ship = ship