Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Wednesday, April 1, 2015

D&D Battle simulator (part 1)



Who would win in a battle of 15 peasants against a hill giant? In Dungeons and Dragons it is quite hard to predict the difficulty of an encounter. Unlike previous editions, in fifth edition the challenge is based on XP, while the challenge rating (CR) limits how nasty the monster can get. However, it isn't quite right.
In order to find out what the victory probabilities are as various parameters are changed I wrote a Python script to simulate D&D battles. The script can be found in my GitHub repository: https://github.com/matteoferla/tangents/blob/master/DnD_Battler.py