\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
normalonceallavg
count10000.00000010000.00000010000.0000010000.0
mean93.266200101.902300103.10310103.0
std9.9861368.9540038.753590.0
min58.00000070.00000064.00000103.0
25%87.00000096.00000097.00000103.0
50%93.000000102.000000103.00000103.0
75%100.000000108.000000109.00000103.0
max129.000000133.000000133.00000103.0
\n
" }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Hacky code. I'm trying to make this explicit for clarity.\n", "import random\n", "def get_hp_values(pc_level=20):\n", " normal= 8 # all players start with max hp\n", " avg_hp = normal\n", " roll_all= normal\n", " roll_once = normal\n", " for _ in range (pc_level - 1): # Roll for each of the 19 levels past first\n", " avg_hp = avg_hp + 5\n", " normal = normal + random.randint(1, 8)\n", " roll_all = roll_all + random.randint(2, 8)\n", " for _ in range(pc_level - 1):\n", " roll = random.randint(1, 8)\n", " if roll == 1:\n", " roll = random.randint(1, 8)\n", " roll_once = roll_once + roll\n", " return [normal, roll_all, roll_once, avg_hp]\n", "\n", "avg_hp, normal, roll_all, roll_once = [], [], [], []\n", "for _ in range(10000):\n", " result = get_hp_values(20) # Change this value for the level of PC you want to simulate.\n", " normal.append(result[0])\n", " roll_all.append(result[1])\n", " roll_once.append(result[2])\n", " avg_hp.append(result[3])\n", "\n", "hp_rolls = pd.DataFrame({'normal': normal, 'once': roll_once, 'all': roll_all, 'avg': avg_hp})\n", "hp_rolls.describe()" ], "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } } } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.5" } }, "nbformat": 4, "nbformat_minor": 5 }