reducing the amount of loops further, using defending_ships as stack instead of iterable