if (car_door == choice) {
    if (door_switch == 1) {
        result = 0;
    } else {
        result = 1;
    }
    return result;
}

if (choice != 1 && car_door != 1) {
    host_door = 1;
} else {
    if (choice != 2 && car_door != 2) {
        host_door = 2;
    } else {
        host_door = 3;
    }
}

if (door_switch == 1) {
    if (host_door == 1) {
        if (choice == 2) {
            choice_updated = 3;
        } else {
            choice_updated = 2;
        }
    } else {
        if (host_door == 2) {
            if (choice == 1) {
                choice_updated = 3;
            } else {
                choice_updated = 1;
            }
        } else {
            if (choice == 1) {
                choice_updated = 2;
            } else {
                choice_updated = 1;
            }
        }
    }
} else {
    choice_updated = choice;
}

if (choice_updated == car_door) {
    result = 1;
} else {
    result = 0;
}

