refactored generateAliveShips