期待已久的新活动规则终于发布了
对于发帖困难户而言不用发帖真是太好了
初看了下规则,感觉挺难活的,出于对最终存活概率的好奇,利用AI生成的代码简单计算了下概率,居然可以达到0.56!??比心里预期着实高了不少。
其实冷静下想想也是,过载的情况其实挺难触发的,1/3概率可以选到人最多的不扣血,1/3概率选到15,还有1/3选到25,只要6天扣15,1天不扣就可以存活,好像也不是很难(才怪)
所以战略就是随大流,混几天不扣血的日子,跟着大多数总是好的~
以下是代码以及预设的条件,有兴趣的可以进一步优化一下,把场地的随机性也考虑进去哟~
预设条件:
1、假设场地一直是【对战广场】无特殊规则。
2、玩家为1000人,玩家随机选择没有倾向
3、模拟次数为10000次
以下是代码(感谢kimi的贡献,AI真是太好用了) - import numpy as np
- def simulate():
- days = 7 # 活动天数
- initial_health = 100 # 初始血量
- players = 1000 # 玩家人数
- simulations = 10000 # 模拟次数
- survive_count = 0
- for _ in range(simulations):
- health = initial_health
- for _ in range(days):
- # 每个玩家随机选择一个属性
- choices = np.random.choice(['grass', 'fire', 'water'], size=players)
- # 统计每个属性的数量
- grass_count = np.sum(choices == 'grass')
- fire_count = np.sum(choices == 'fire')
- water_count = np.sum(choices == 'water')
- total = players
- # 确定场地属性
- max_count = max(grass_count, fire_count, water_count)
- if max_count >= 0.8 * total:
- # 触发属性过载
- if grass_count == max_count:
- field_attribute = 'grass'
- elif fire_count == max_count:
- field_attribute = 'fire'
- else:
- field_attribute = 'water'
-
- # 所有玩家扣血
- player_choice = np.random.choice(['grass', 'fire', 'water'])
- if player_choice == field_attribute:
- health -= 15
- elif (player_choice == 'grass' and field_attribute == 'water') or \
- (player_choice == 'fire' and field_attribute == 'grass') or \
- (player_choice == 'water' and field_attribute == 'fire'):
- health -= 15
- else:
- health -= 25
- else:
- # 选择数量最多的属性
- if grass_count == max_count:
- field_attribute = 'grass'
- elif fire_count == max_count:
- field_attribute = 'fire'
- else:
- field_attribute = 'water'
- # 随机选择一个玩家的属性
- player_choice = np.random.choice(['grass', 'fire', 'water'])
- if player_choice == field_attribute:
- # 不扣血
- pass
- elif (player_choice == 'grass' and field_attribute == 'water') or \
- (player_choice == 'fire' and field_attribute == 'grass') or \
- (player_choice == 'water' and field_attribute == 'fire'):
- # 克制场地属性
- health -= 15
- else:
- # 被场地属性克制
- health -= 25
- # 检查是否被淘汰
- if health <= 0:
- break
- if health > 0:
- survive_count += 1
- survival_probability = survive_count / simulations
- return survival_probability
- # 运行模拟
- probability = simulate()
- print(f"存活概率: {probability:.4f}")
复制代码
最后再叠个甲,如果计算有错误,麻烦指正~ 如果看完感觉有用,别忘了留个追随~ |