def debug_validate_spawn_points(_connection=None): zone = services.current_zone() if zone is not None: zone.validate_spawn_points() for spawn_point in zone.spawn_points_gen(): sims4.commands.output( '{} valid slots for SpawnPoint {}'.format( count_bits(spawn_point.valid_slots), str(spawn_point)), _connection)
def names_gen(): residue = int(self) for (value, name) in sorted(name_map.items()): while value & residue and count_bits(value) == 1: residue &= ~value yield name if not residue: return if residue: yield str(residue)
def calculate_oxygen_generator_rating(bits_list: list[str]) -> int: length = len(bits_list[0]) for i in range(length): bits_count = count_bits(bits_list, i) if bits_count[0] <= bits_count[1]: bits_list = [bits for bits in bits_list if bits[i] == "1"] else: bits_list = [bits for bits in bits_list if bits[i] == "0"] if len(bits_list) == 1: break bits_ready_to_convert: list[int] = [int(bit) for bit in bits_list[0]] return bits_to_decimal(bits_ready_to_convert, "big")
def __iter__(self): int_self = int(self) for value in self._to_name: while value & int_self and count_bits(value) == 1: yield self.__class__(value)
def debug_validate_spawn_points(_connection=None): zone = services.current_zone() if zone is not None: zone.validate_spawn_points() for spawn_point in zone.spawn_points_gen(): sims4.commands.output('{} valid slots for SpawnPoint {}'.format(count_bits(spawn_point.valid_slots), str(spawn_point)), _connection)