import random
def simulate_until_target(target_featured):
five_star_prob = 0.01
pity_counter = 0
guaranteed_featured = False
featured_count = 0
total_wishes = 0
while featured_count < target_featured:
total_wishes += 1
if pity_counter >= 60:
five_star_prob = min(five_star_prob + 0.10, 1.0)
if random.random() < five_star_prob:
if guaranteed_featured or random.random() < 0.5:
result = f"第{total_wishes}次许愿结果: 5星思念【祁煜·沉入无尽海】"
featured_count += 1
guaranteed_featured = False
else:
result = f"第{total_wishes}次许愿结果: 5星思念(非本期活动限定)"
guaranteed_featured = True
print(result)
five_star_prob = 0.01
pity_counter = 0
else:
pity_counter += 1
return total_wishes
target_featured = 4
total_wishes = simulate_until_target(target_featured)
print(f"\n获得 {target_featured} 张【祁煜·沉入无尽海】所需的许愿次数: {total_wishes} 次")