Guest User

Untitled

a guest
Apr 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.95 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 6,
  6. "metadata": {
  7. "collapsed": false
  8. },
  9. "outputs": [
  10. {
  11. "name": "stdout",
  12. "output_type": "stream",
  13. "text": [
  14. "Expected Cost:\n",
  15. "350.0\n",
  16. "\n",
  17. "\n",
  18. "Value of Fixed Items:\n",
  19. "36.120000000000005\n",
  20. "\n",
  21. "\n",
  22. "Value of Fixed Items After Selling:\n",
  23. "18.060000000000002\n",
  24. "\n",
  25. "\n",
  26. "Per-item Expected Value:\n",
  27. "Bag of Gold: 8.0 100 @ 8.0%\n",
  28. "Silver coffer: 35.0 500 @ 7.000000000000001%\n",
  29. "Gems: 80.0 1000 @ 8.0%\n",
  30. "Wooden Ladder: 0.014000000000000002 0.1 @ 14.000000000000002%\n",
  31. "Riding Horse+Riding Saddle+Saddlebags: 6.23 89 @ 7.000000000000001%\n",
  32. "Potions of Healing: 18.0 200 @ 9.0%\n",
  33. "Rowboat: 3.5000000000000004 50 @ 7.000000000000001%\n",
  34. "Spell Scroll: 12.0 150.0 @ 8.0%\n",
  35. "Mastiffs: 3.5000000000000004 50 @ 7.000000000000001%\n",
  36. "Portable Ram: 0.16 4 @ 4.0%\n",
  37. "\n",
  38. "\n",
  39. "Average Patch Value: \n",
  40. "166.404\n",
  41. "\n",
  42. "\n",
  43. "Average Patch Value After Selling: \n",
  44. "159.70200000000003\n",
  45. "\n",
  46. "\n",
  47. "Average Patch Value After Selling: \n",
  48. "123.0\n",
  49. "\n",
  50. "\n",
  51. "Intangle Percentage\n",
  52. "21.000000000000004%\n",
  53. "\n",
  54. "\n",
  55. "Expected Total Monetary Value:\n",
  56. "1700.1599999999999\n",
  57. "\n",
  58. "\n",
  59. "Expected Total Monetary Value After Selling:\n",
  60. "1615.0800000000002\n",
  61. "\n",
  62. "\n",
  63. "Expected Profit:\n",
  64. "1265.0800000000002\n",
  65. "\n",
  66. "\n",
  67. "Expected Value of Only Treasure:\n",
  68. "1230.0\n",
  69. "\n",
  70. "\n",
  71. "Expected Profit of Only Treasure:\n",
  72. "880.0\n",
  73. "\n",
  74. "\n",
  75. "Expected Number of \"Intangible\" Patches\n",
  76. "2.1\n"
  77. ]
  78. }
  79. ],
  80. "source": [
  81. "#1d6 * 100, per XGtE 162\n",
  82. "print(\"Expected Cost:\")\n",
  83. "cost = 3.5*100\n",
  84. "print(cost)\n",
  85. "\n",
  86. "print(\"\\n\")\n",
  87. "#(\"item\", value)\n",
  88. "fixed_value_items = [\n",
  89. " (\"Dagger\", 2),\n",
  90. " (\"Lantern\", 10), \n",
  91. " (\"Mirror\", 5), \n",
  92. " (\"Pole\", 0.05), \n",
  93. " (\"Hempen Rope\", 1), \n",
  94. " (\"Sack\", 0.01 )\n",
  95. "]\n",
  96. "fixed_value_sum = 0\n",
  97. "for item in fixed_value_items:\n",
  98. " fixed_value_sum = fixed_value_sum + (2 * item[1])\n",
  99. "print(\"Value of Fixed Items:\")\n",
  100. "print(fixed_value_sum)\n",
  101. "print(\"\\n\")\n",
  102. "print(\"Value of Fixed Items After Selling:\")\n",
  103. "print(fixed_value_sum/2)\n",
  104. "print(\"\\n\")\n",
  105. "\n",
  106. "#(\"item\", start roll, end roll, value, sell multiplier, treasure)\n",
  107. "#value will be listed as 'intangible' for options such as the window\n",
  108. "#sell multiplier assumes magic items and treasure sell for full price, other items sell for half\n",
  109. "variable_items = [\n",
  110. " (\"Bag of Gold\", 1, 8, 100, 1, True),\n",
  111. " (\"Silver coffer\", 9, 15, 500, 1, True),\n",
  112. " (\"Iron Door\", 16, 22, \"Intangible\", False),\n",
  113. " (\"Gems\", 23, 30, 1000, 1, True),\n",
  114. " (\"Wooden Ladder\", 31, 44, 0.1, .5, False),\n",
  115. " (\"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",
  116. " (\"Pit\", 52, 59, \"Intangible\", False),\n",
  117. " (\"Potions of Healing\", 60, 68, 200, 1, False),\n",
  118. " (\"Rowboat\", 69, 75, 50, .5, False),\n",
  119. " (\"Spell Scroll\", 76, 83, ((50/3)+(200/3)+200/3), 1, False), #Per XGtE 133, \"Magic Item Base Prices\"\n",
  120. " (\"Mastiffs\", 84, 90, (2*25), .5, False),\n",
  121. " (\"Window\", 91, 96, \"Intangible\", False),\n",
  122. " (\"Portable Ram\", 97, 100, 4, .5, False)\n",
  123. "]\n",
  124. "sum_expected_patch_value = 0\n",
  125. "sum_expected_patch_value_selling = 0\n",
  126. "sum_expected_treasure_value = 0\n",
  127. "intanglible_probability = 0\n",
  128. "print(\"Per-item Expected Value:\")\n",
  129. "for item in variable_items:\n",
  130. " if type(item[3]) is not str:\n",
  131. " item_probability = ((item[2] - item[1]) + 1)/100\n",
  132. " expected_patch_value = item_probability * item[3]\n",
  133. " expected_patch_value_selling = expected_patch_value * item[4]\n",
  134. " sum_expected_patch_value = sum_expected_patch_value + expected_patch_value\n",
  135. " sum_expected_patch_value_selling = sum_expected_patch_value_selling + expected_patch_value_selling\n",
  136. " if item[5]:\n",
  137. " sum_expected_treasure_value += expected_patch_value_selling\n",
  138. " print(item[0]+ \": \" + str(expected_patch_value) +\" \" + str(item[3]) + \" @ \" + str(item_probability*100) + \"%\")\n",
  139. " else:\n",
  140. " intanglible_probability += ((item[2] - item[1]) + 1)/100\n",
  141. "print(\"\\n\")\n",
  142. "print(\"Average Patch Value: \")\n",
  143. "print(sum_expected_patch_value)\n",
  144. "print(\"\\n\")\n",
  145. "print(\"Average Patch Value After Selling: \")\n",
  146. "print(sum_expected_patch_value_selling)\n",
  147. "print(\"\\n\")\n",
  148. "print(\"Average Patch Value After Selling: \")\n",
  149. "print(sum_expected_treasure_value)\n",
  150. "print(\"\\n\")\n",
  151. "print(\"Intangle Percentage\")\n",
  152. "print(str((intanglible_probability*100)) + \"%\")\n",
  153. "print(\"\\n\")\n",
  154. "#4d4 patches, min 4, max 16, average 10\n",
  155. "avg_num_patches = 10\n",
  156. "print(\"Expected Total Monetary Value:\")\n",
  157. "total_value = (avg_num_patches * sum_expected_patch_value)+fixed_value_sum\n",
  158. "print(total_value)\n",
  159. "print(\"\\n\")\n",
  160. "print(\"Expected Total Monetary Value After Selling:\")\n",
  161. "total_value = (avg_num_patches * sum_expected_patch_value_selling)+(fixed_value_sum/2)\n",
  162. "print(total_value)\n",
  163. "print(\"\\n\")\n",
  164. "print(\"Expected Profit:\")\n",
  165. "print(total_value-cost)\n",
  166. "print(\"\\n\")\n",
  167. "print(\"Expected Value of Only Treasure:\")\n",
  168. "print(avg_num_patches*sum_expected_treasure_value)\n",
  169. "print(\"\\n\")\n",
  170. "print(\"Expected Profit of Only Treasure:\")\n",
  171. "print((avg_num_patches*sum_expected_treasure_value)-cost)\n",
  172. "print(\"\\n\")\n",
  173. "\n",
  174. "print(\"Expected Number of \\\"Intangible\\\" Patches\")\n",
  175. "intangible_expectation = avg_num_patches * intanglible_probability\n",
  176. "print(intangible_expectation)"
  177. ]
  178. },
  179. {
  180. "cell_type": "code",
  181. "execution_count": null,
  182. "metadata": {
  183. "collapsed": true
  184. },
  185. "outputs": [],
  186. "source": []
  187. }
  188. ],
  189. "metadata": {
  190. "kernelspec": {
  191. "display_name": "Python [conda root]",
  192. "language": "python",
  193. "name": "conda-root-py"
  194. },
  195. "language_info": {
  196. "codemirror_mode": {
  197. "name": "ipython",
  198. "version": 3
  199. },
  200. "file_extension": ".py",
  201. "mimetype": "text/x-python",
  202. "name": "python",
  203. "nbconvert_exporter": "python",
  204. "pygments_lexer": "ipython3",
  205. "version": "3.5.2"
  206. }
  207. },
  208. "nbformat": 4,
  209. "nbformat_minor": 1
  210. }
Add Comment
Please, Sign In to add comment