Created
April 11, 2018 18:24
-
-
Save benjaminlippi/cf13f05b1fbbc61c7da1334a53ca09d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "metadata": { | |
| "collapsed": false | |
| }, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "Expected Cost:\n", | |
| "350.0\n", | |
| "\n", | |
| "\n", | |
| "Value of Fixed Items:\n", | |
| "36.120000000000005\n", | |
| "\n", | |
| "\n", | |
| "Value of Fixed Items After Selling:\n", | |
| "18.060000000000002\n", | |
| "\n", | |
| "\n", | |
| "Per-item Expected Value:\n", | |
| "Bag of Gold: 8.0 100 @ 8.0%\n", | |
| "Silver coffer: 35.0 500 @ 7.000000000000001%\n", | |
| "Gems: 80.0 1000 @ 8.0%\n", | |
| "Wooden Ladder: 0.014000000000000002 0.1 @ 14.000000000000002%\n", | |
| "Riding Horse+Riding Saddle+Saddlebags: 6.23 89 @ 7.000000000000001%\n", | |
| "Potions of Healing: 18.0 200 @ 9.0%\n", | |
| "Rowboat: 3.5000000000000004 50 @ 7.000000000000001%\n", | |
| "Spell Scroll: 12.0 150.0 @ 8.0%\n", | |
| "Mastiffs: 3.5000000000000004 50 @ 7.000000000000001%\n", | |
| "Portable Ram: 0.16 4 @ 4.0%\n", | |
| "\n", | |
| "\n", | |
| "Average Patch Value: \n", | |
| "166.404\n", | |
| "\n", | |
| "\n", | |
| "Average Patch Value After Selling: \n", | |
| "159.70200000000003\n", | |
| "\n", | |
| "\n", | |
| "Average Patch Value After Selling: \n", | |
| "123.0\n", | |
| "\n", | |
| "\n", | |
| "Intangle Percentage\n", | |
| "21.000000000000004%\n", | |
| "\n", | |
| "\n", | |
| "Expected Total Monetary Value:\n", | |
| "1700.1599999999999\n", | |
| "\n", | |
| "\n", | |
| "Expected Total Monetary Value After Selling:\n", | |
| "1615.0800000000002\n", | |
| "\n", | |
| "\n", | |
| "Expected Profit:\n", | |
| "1265.0800000000002\n", | |
| "\n", | |
| "\n", | |
| "Expected Value of Only Treasure:\n", | |
| "1230.0\n", | |
| "\n", | |
| "\n", | |
| "Expected Profit of Only Treasure:\n", | |
| "880.0\n", | |
| "\n", | |
| "\n", | |
| "Expected Number of \"Intangible\" Patches\n", | |
| "2.1\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "#1d6 * 100, per XGtE 162\n", | |
| "print(\"Expected Cost:\")\n", | |
| "cost = 3.5*100\n", | |
| "print(cost)\n", | |
| "\n", | |
| "print(\"\\n\")\n", | |
| "#(\"item\", value)\n", | |
| "fixed_value_items = [\n", | |
| " (\"Dagger\", 2),\n", | |
| " (\"Lantern\", 10), \n", | |
| " (\"Mirror\", 5), \n", | |
| " (\"Pole\", 0.05), \n", | |
| " (\"Hempen Rope\", 1), \n", | |
| " (\"Sack\", 0.01 )\n", | |
| "]\n", | |
| "fixed_value_sum = 0\n", | |
| "for item in fixed_value_items:\n", | |
| " fixed_value_sum = fixed_value_sum + (2 * item[1])\n", | |
| "print(\"Value of Fixed Items:\")\n", | |
| "print(fixed_value_sum)\n", | |
| "print(\"\\n\")\n", | |
| "print(\"Value of Fixed Items After Selling:\")\n", | |
| "print(fixed_value_sum/2)\n", | |
| "print(\"\\n\")\n", | |
| "\n", | |
| "#(\"item\", start roll, end roll, value, sell multiplier, treasure)\n", | |
| "#value will be listed as 'intangible' for options such as the window\n", | |
| "#sell multiplier assumes magic items and treasure sell for full price, other items sell for half\n", | |
| "variable_items = [\n", | |
| " (\"Bag of Gold\", 1, 8, 100, 1, True),\n", | |
| " (\"Silver coffer\", 9, 15, 500, 1, True),\n", | |
| " (\"Iron Door\", 16, 22, \"Intangible\", False),\n", | |
| " (\"Gems\", 23, 30, 1000, 1, True),\n", | |
| " (\"Wooden Ladder\", 31, 44, 0.1, .5, False),\n", | |
| " (\"Riding Horse+Riding Saddle+Saddlebags\", 45, 51, (75+10+4), .5, False), #Per PHB 157, assuming saddle bags means it has a saddle too\n", | |
| " (\"Pit\", 52, 59, \"Intangible\", False),\n", | |
| " (\"Potions of Healing\", 60, 68, 200, 1, False),\n", | |
| " (\"Rowboat\", 69, 75, 50, .5, False),\n", | |
| " (\"Spell Scroll\", 76, 83, ((50/3)+(200/3)+200/3), 1, False), #Per XGtE 133, \"Magic Item Base Prices\"\n", | |
| " (\"Mastiffs\", 84, 90, (2*25), .5, False),\n", | |
| " (\"Window\", 91, 96, \"Intangible\", False),\n", | |
| " (\"Portable Ram\", 97, 100, 4, .5, False)\n", | |
| "]\n", | |
| "sum_expected_patch_value = 0\n", | |
| "sum_expected_patch_value_selling = 0\n", | |
| "sum_expected_treasure_value = 0\n", | |
| "intanglible_probability = 0\n", | |
| "print(\"Per-item Expected Value:\")\n", | |
| "for item in variable_items:\n", | |
| " if type(item[3]) is not str:\n", | |
| " item_probability = ((item[2] - item[1]) + 1)/100\n", | |
| " expected_patch_value = item_probability * item[3]\n", | |
| " expected_patch_value_selling = expected_patch_value * item[4]\n", | |
| " sum_expected_patch_value = sum_expected_patch_value + expected_patch_value\n", | |
| " sum_expected_patch_value_selling = sum_expected_patch_value_selling + expected_patch_value_selling\n", | |
| " if item[5]:\n", | |
| " sum_expected_treasure_value += expected_patch_value_selling\n", | |
| " print(item[0]+ \": \" + str(expected_patch_value) +\" \" + str(item[3]) + \" @ \" + str(item_probability*100) + \"%\")\n", | |
| " else:\n", | |
| " intanglible_probability += ((item[2] - item[1]) + 1)/100\n", | |
| "print(\"\\n\")\n", | |
| "print(\"Average Patch Value: \")\n", | |
| "print(sum_expected_patch_value)\n", | |
| "print(\"\\n\")\n", | |
| "print(\"Average Patch Value After Selling: \")\n", | |
| "print(sum_expected_patch_value_selling)\n", | |
| "print(\"\\n\")\n", | |
| "print(\"Average Patch Value After Selling: \")\n", | |
| "print(sum_expected_treasure_value)\n", | |
| "print(\"\\n\")\n", | |
| "print(\"Intangle Percentage\")\n", | |
| "print(str((intanglible_probability*100)) + \"%\")\n", | |
| "print(\"\\n\")\n", | |
| "#4d4 patches, min 4, max 16, average 10\n", | |
| "avg_num_patches = 10\n", | |
| "print(\"Expected Total Monetary Value:\")\n", | |
| "total_value = (avg_num_patches * sum_expected_patch_value)+fixed_value_sum\n", | |
| "print(total_value)\n", | |
| "print(\"\\n\")\n", | |
| "print(\"Expected Total Monetary Value After Selling:\")\n", | |
| "total_value = (avg_num_patches * sum_expected_patch_value_selling)+(fixed_value_sum/2)\n", | |
| "print(total_value)\n", | |
| "print(\"\\n\")\n", | |
| "print(\"Expected Profit:\")\n", | |
| "print(total_value-cost)\n", | |
| "print(\"\\n\")\n", | |
| "print(\"Expected Value of Only Treasure:\")\n", | |
| "print(avg_num_patches*sum_expected_treasure_value)\n", | |
| "print(\"\\n\")\n", | |
| "print(\"Expected Profit of Only Treasure:\")\n", | |
| "print((avg_num_patches*sum_expected_treasure_value)-cost)\n", | |
| "print(\"\\n\")\n", | |
| "\n", | |
| "print(\"Expected Number of \\\"Intangible\\\" Patches\")\n", | |
| "intangible_expectation = avg_num_patches * intanglible_probability\n", | |
| "print(intangible_expectation)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": { | |
| "collapsed": true | |
| }, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python [conda root]", | |
| "language": "python", | |
| "name": "conda-root-py" | |
| }, | |
| "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.5.2" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment