Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calc_odds(moves):
- tmp_rolls = { 0:1 }
- for move in moves :
- total_rolls = { }
- for move_dmg, move_roll in move.items() :
- for tmp_dmg, tmp_roll in tmp_rolls.items() :
- new_dmg = move_dmg+tmp_dmg
- added_roll = move_roll*tmp_roll
- if not new_dmg in total_rolls:
- total_rolls[new_dmg] = added_roll
- else :
- total_rolls[new_dmg] += added_roll
- tmp_rolls = total_rolls.copy()
- return total_rolls
- def OHKO_odds(hp, moves, total_rolls):
- ko = 0
- total_odds = 39**(len(moves))
- for dmg, roll in total_rolls.items():
- if(dmg >= hp) :
- ko += roll
- return 10000*ko/total_odds // 100
- MS = { 6:7, 7:31, 8:1 }
- #R1 = { 17:13, 18:13, 19:12, 20:1 }
- #R2 = { 34:7, 35:6, 36:6, 37:7, 38:6, 39:6, 40:1 }
- D = { 17:13, 18:13, 19:12, 20:1 }
- D_1 = { 25:4, 26:9, 27:8, 28:9, 29:8, 30:1 }
- hp = 69
- moves = [ MS, MS, MS, MS, MS, D, D ] # [D_1, D_1, D_1]
- rolls = calc_odds(moves)
- ohko = OHKO_odds(hp, moves, rolls)
- print(rolls)
- print(ohko)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement