def shuffle_key_doors(builder, world, player):
    start_regions = convert_regions(builder.path_entrances, world, player)
    num_key_doors = 0
    skips = []
    for region in builder.master_sector.regions:
        for ext in region.exits:
            d = world.check_for_door(ext.name, player)
            if ((d is not None) and d.smallKey):
                if (d not in skips):
                    if (d.type == DoorType.Interior):
                        skips.append(d.dest)
                    if (d.type == DoorType.Normal):
                        for dp in world.paired_doors[player]:
                            if (d.name == dp.door_a):
                                skips.append(world.get_door(dp.door_b, player))
                                break
                            elif (d.name == dp.door_b):
                                skips.append(world.get_door(dp.door_a, player))
                                break
                    num_key_doors += 1
    builder.key_doors_num = num_key_doors
    find_small_key_door_candidates(builder, start_regions, world, player)
    find_valid_combination(builder, start_regions, world, player)
    reassign_key_doors(builder, world, player)
    log_key_logic(builder.name, world.key_logic[player][builder.name])
def shuffle_key_doors(builder, world, player):
    start_regions = convert_regions(builder.path_entrances, world, player)
    num_key_doors = 0
    skips = []
    for region in builder.master_sector.regions:
        for ext in region.exits:
            d = world.check_for_door(ext.name, player)
            if ((d is not None) and d.smallKey):
                if (d not in skips):
                    if (d.type == DoorType.Interior):
                        skips.append(d.dest)
                    if (d.type == DoorType.Normal):
                        for dp in world.paired_doors[player]:
                            if (d.name == dp.door_a):
                                skips.append(world.get_door(dp.door_b, player))
                                break
                            elif (d.name == dp.door_b):
                                skips.append(world.get_door(dp.door_a, player))
                                break
                    num_key_doors += 1
    builder.key_doors_num = num_key_doors
    find_small_key_door_candidates(builder, start_regions, world, player)
    find_valid_combination(builder, start_regions, world, player)
    reassign_key_doors(builder, world, player)
    log_key_logic(builder.name, world.key_logic[player][builder.name])