Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NUMBER_OF_STUBS = 10
- DEF_REG_CHANCE = 0.90
- SAMPLE_NUM = 10000
- def main():
- import matplotlib.pyplot as plt
- import random as rn
- regDam = 20
- critDam = 80
- regChance = 0.90
- totalDam = 0
- avList = []
- for stub in range(0, SAMPLE_NUM):
- if (rn.random() <= regChance):
- totalDam += regDam
- regChance -= 0.03
- else:
- totalDam += critDam
- regChance = DEF_REG_CHANCE
- avList.append(totalDam / (stub + 1))
- plt.figure(figsize=(20, 10))
- plt.text(1000, 32, f"Approximate damage is {avList[-1]}", color='black', fontsize=32)
- plt.plot(avList)
- plt.title("Average damage approximation")
- plt.xlabel("Number of samples")
- plt.ylabel("Average damage")
- plt.show()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement