def add_pair(door_a, door_b, world, player):
    (pair_a, pair_b) = (None, None)
    for paired_door in world.paired_doors[player]:
        if ((paired_door.door_a == door_a.name) and (paired_door.door_b == door_b.name)):
            paired_door.pair = True
            return
        if ((paired_door.door_a == door_b.name) and (paired_door.door_b == door_a.name)):
            paired_door.pair = True
            return
        if ((paired_door.door_a == door_a.name) or (paired_door.door_b == door_a.name)):
            pair_a = paired_door
        if ((paired_door.door_a == door_b.name) or (paired_door.door_b == door_b.name)):
            pair_b = paired_door
    if pair_a:
        pair_a.pair = False
    if pair_b:
        pair_b.pair = False
    world.paired_doors[player].append(PairedDoor(door_a, door_b))
def add_pair(door_a, door_b, world, player):
    (pair_a, pair_b) = (None, None)
    for paired_door in world.paired_doors[player]:
        if ((paired_door.door_a == door_a.name) and (paired_door.door_b == door_b.name)):
            paired_door.pair = True
            return
        if ((paired_door.door_a == door_b.name) and (paired_door.door_b == door_a.name)):
            paired_door.pair = True
            return
        if ((paired_door.door_a == door_a.name) or (paired_door.door_b == door_a.name)):
            pair_a = paired_door
        if ((paired_door.door_a == door_b.name) or (paired_door.door_b == door_b.name)):
            pair_b = paired_door
    if pair_a:
        pair_a.pair = False
    if pair_b:
        pair_b.pair = False
    world.paired_doors[player].append(PairedDoor(door_a, door_b))