This is a documentation for Board Game Arena: play board games online !
Tips seasons
跳至導覽
跳至搜尋
- -*- coding: utf-8 -*-
""" 卡牌策略數學模擬器 根據用戶提供的策略(資源平衡、Temporal Boots 抽牌概率、Necrotic Kriss 傷害估算) """
def resource_balance(energy_cards, crystal_cards, avg_energy_per_card, avg_crystal_per_card, deck_size, turns):
""" 计算总期望能量和晶体 energy_cards: 能量卡数量 crystal_cards: 晶体卡数量 avg_energy_per_card: 每张能量卡平均提供能量 avg_crystal_per_card: 每张晶体卡平均提供晶体 deck_size: 总牌库数量 turns: 游戏回合数 """ # 简化模型:假设每回合抽固定张数,且所有卡都会在 turns 回合内过到一次 total_draws = turns * 5 # 假设每回合抽5张 energy_expected = energy_cards * avg_energy_per_card * (total_draws / deck_size) crystal_expected = crystal_cards * avg_crystal_per_card * (total_draws / deck_size) return energy_expected, crystal_expected
def boots_miss_prob(deck_size, copies, hand_size, turns):
"""
计算 Temporal Boots 在指定回合数内仍未抽到的概率
deck_size: 总牌库数量
copies: Boots 数量(通常为1)
hand_size: 每回合抽牌数
turns: 已进行回合数
"""
if copies == 0:
return 1.0
total_drawn = min(hand_size * turns, deck_size)
# 超几何分布:未抽到任何一张 Boots 的概率
prob = 1.0
for i in range(copies):
prob *= (deck_size - total_drawn - i) / (deck_size - i)
return max(0, prob)
def kriss_damage(turns, cards_per_turn, starting_discard=0):
""" Necrotic Kriss 造成的总伤害估算 每张在弃牌堆中的卡造成1点伤害 turns: 回合数 cards_per_turn: 每回合进入弃牌堆的卡数(包括打出的和弃掉的) starting_discard: 初始弃牌堆数量 """ total_discard = starting_discard + turns * cards_per_turn # Kriss 打出的那一刻,伤害等于当前弃牌堆大小 # 这里假设你在最后一回合才打出 Kriss return total_discard
def main():
print("=" * 50)
print("卡牌策略数学模拟器(中文版)")
print("=" * 50)
# 1. 资源平衡示例
print("\n1. 资源平衡计算(能量卡 vs 晶体卡)")
e_cards = 8 # 能量卡数量
c_cards = 7 # 晶体卡数量
e_per = 1.5 # 每张能量卡平均产能量
c_per = 2.0 # 每张晶体卡平均产晶体
deck = 30 # 牌库大小
turns = 10 # 进行10回合
energy, crystal = resource_balance(e_cards, c_cards, e_per, c_per, deck, turns)
print(f" 牌库 {deck} 张,{turns} 回合内:")
print(f" 期望获得能量: {energy:.2f}")
print(f" 期望获得晶体: {crystal:.2f}")
print(f" 能量/晶体比值: {energy/crystal:.2f}")
# 2. Temporal Boots 未抽到概率
print("\n2. Temporal Boots 未抽到概率")
boots_copies = 1
hand = 5
for t in [3, 5, 7]:
prob = boots_miss_prob(deck, boots_copies, hand, t)
print(f" 第 {t} 回合结束时仍未抽到 Boots 的概率: {prob:.3f}")
# 3. Necrotic Kriss 伤害
print("\n3. Necrotic Kriss 伤害估算(最后一回合打出)")
for t in [5, 8, 10]:
dmg = kriss_damage(t, cards_per_turn=4, starting_discard=5)
print(f" 第 {t} 回合打出 Kriss,弃牌堆大小 = {dmg} → 造成 {dmg} 点伤害")
# 4. 组合技额外回合期望
print("\n4. Temporal Boots + Amsug Longneck 额外回合期望")
p_boots = 1 - boots_miss_prob(deck, 1, hand, 5) # 前5回合抽到Boots概率
p_longneck = 0.4 # 假设手中有Longneck的概率40%
extra_turns = p_boots * p_longneck * 1.2 # 1.2为可能的回手因子
print(f" 前5回合抽到Boots概率: {p_boots:.3f}")
print(f" 同时有Longneck概率: {p_longneck:.2f}")
print(f" 期望额外回合数: {extra_turns:.3f}")
print(f" 总伤害倍数 ≈ 1 + {extra_turns:.3f} = {1+extra_turns:.3f}")
print("\n提示:实际游戏中还需考虑对手干扰、牌序、抽牌随机性等。")
if __name__ == "__main__":
main()