├── LICENSE ├── README.md ├── dataResults.csv ├── monteCarloFinal1.py ├── monteCarloFinal2.py ├── monteCarloTutorial.py ├── montecarlo1.py ├── montecarlo10.py ├── montecarlo11.py ├── montecarlo11old.py ├── montecarlo13.py ├── montecarlo14 d'alembert.py ├── montecarlo15 - testing multiple 50 50.py ├── montecarlo16.py ├── montecarlo17 50 50 odds multiple test.py ├── montecarlo2.py ├── montecarlo3.py ├── montecarlo4.py ├── montecarlo5.py ├── montecarlo6.py ├── montecarlo7.py ├── montecarlo8.py └── montecarlo9.py /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 PythonProgramming.net 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Monte-Carlo-Simulator 2 | http://pythonprogramming.net/monte-carlo-simulator-python/ 3 | -------------------------------------------------------------------------------- /dataResults.csv: -------------------------------------------------------------------------------- 1 | 57.798030948,84.4294330328,780475.971916 2 | 80.4503750287,66.3917106729,753336.024894 3 | 98.7151825661,39.4325425879,603083.856975 4 | 62.7655101658,99.4216339124,779289.687349 5 | 85.2886477246,68.7001688014,760655.635629 6 | 89.7445359819,51.0242179651,668701.045261 7 | 94.6102004497,85.3465183061,635631.935376 8 | 96.7193026068,75.1655752837,1206170.90501 9 | 99.0882396267,88.9113066095,838285.764397 10 | 88.7685985025,52.028226873,682604.579708 11 | 53.9755701041,95.6734673883,694547.540313 12 | 64.187284389,91.1888724237,889490.381622 13 | 96.668501199,79.8527362144,694555.054198 14 | 93.9659411156,70.6877349101,732805.385284 15 | 93.5679743923,53.5700705007,865878.653138 16 | 66.8805268611,94.0986454988,639001.776039 17 | 62.3053186278,93.1890707341,1331496.07016 18 | 96.52026228,47.5335082268,811760.992356 19 | 65.394385071,74.6934140586,747846.277489 20 | 71.9801969352,86.8072664533,611891.562883 21 | 97.6787990094,87.4076163351,947707.207254 22 | 89.9006028378,94.8300780672,747182.903301 23 | 81.3849413131,68.2677811108,820039.427211 24 | 87.0712282299,84.3944207386,871970.98826 25 | 57.1094191872,95.4302336055,854185.806412 26 | 78.6995892442,82.1971007124,1195307.65214 27 | 94.8361194575,91.0340264776,608043.854693 28 | 60.2110987173,60.2941014656,744217.655884 29 | 94.045019919,74.6407953641,871342.437856 30 | 77.7124765112,70.1230342141,973715.278539 31 | 79.236560693,96.9396196063,908112.43293 32 | 97.0839491569,78.7824048843,831481.28287 33 | 92.9560208898,82.917922164,1203730.88103 34 | 67.5513203964,62.3134323054,684522.021481 35 | 63.8875500148,77.4858733455,743866.696483 36 | 98.861138987,56.3772844058,609304.935908 37 | 86.1484847527,93.0240773537,840060.011654 38 | 90.0908561565,96.5252441372,647766.265873 39 | 73.4910700915,51.1237709191,639607.449367 40 | 95.4089714405,79.8520815881,619666.079595 41 | 88.5162509278,86.7595456019,941018.069501 42 | 89.0285854766,75.0186689314,1401241.46946 43 | 89.1879443471,97.5761542264,801181.648389 44 | 88.5798236281,94.2892858843,606434.476952 45 | 79.6413135182,83.7935196103,891974.991112 46 | 94.5825607458,98.9708526827,750627.653138 47 | 82.1491323979,75.5175605512,621708.949746 48 | 89.7155848495,56.6246953745,872670.069253 49 | 96.2131875771,58.1525476018,662464.027582 50 | 88.5293996597,89.8588881547,724162.844892 51 | 42.3822655246,63.4146342207,615830.428024 52 | 84.8883975074,89.2757691624,723604.063522 53 | 96.1428250086,71.3247075163,627786.008926 54 | 82.8064777181,48.2812050291,631768.087366 55 | 70.4473576094,90.9978784784,911863.354322 56 | 74.0586380078,98.649953834,964946.868761 57 | 73.2685669944,90.4640931612,776462.479332 58 | 81.7197231159,86.3505773624,783482.431975 59 | 73.3388054465,97.7209414277,670643.518657 60 | 82.4660867035,79.4097079334,667401.987639 61 | 93.5617983835,46.395720106,615939.543611 62 | 94.3775132098,56.2838750255,656140.555066 63 | 76.9052342844,92.706546906,765302.182394 64 | 67.9891849371,84.3108212261,670921.712698 65 | 85.8692223792,99.5977335435,1091676.58627 66 | 57.3757784551,91.9403217862,692217.501658 67 | 79.5104512332,60.3186759307,850962.076903 68 | 63.3754416416,94.8376448605,782208.896052 69 | 67.2918081181,86.393162613,880438.003543 70 | 87.5410068924,45.4064817135,646420.089482 71 | 94.0330300071,34.8240659781,813035.149408 72 | 86.1950165771,94.2348843354,765763.41766 73 | 95.2468195453,83.4520931423,1053316.2563 74 | 66.0659859273,82.5546878306,853902.067524 75 | 88.6962421309,99.8704865709,709978.862445 76 | 72.4218396661,58.1997422578,626596.745119 77 | 78.1132920487,98.3706663435,784271.124896 78 | 89.2833056412,89.5588429636,1269208.32005 79 | 73.7217879982,79.0546014591,962292.586267 80 | 74.2791261312,94.2982029454,625421.955084 81 | 73.6305718318,97.7951257981,1081370.64231 82 | 85.4286957104,71.3841430958,1042124.17313 83 | 94.8021281157,98.4267094362,658449.805341 84 | 97.8434777186,87.7289518567,997132.932269 85 | 94.6032894574,86.4863840346,1528282.0605 86 | 99.6973472213,86.3870106347,703587.322491 87 | 96.0386322385,92.6458570398,724962.759156 88 | 84.5533460407,48.4490527813,648321.356704 89 | 75.022647345,89.7788515536,784122.375577 90 | 94.5695532978,70.9720249869,927092.624671 91 | 98.7304841416,84.2692325781,1121083.95348 92 | 80.2771335672,75.9257518339,674171.090001 93 | 92.9470829883,92.8610336309,771877.896246 94 | 90.0176454923,94.387929054,716500.023976 95 | 96.7145309543,94.4186246003,1054364.73356 96 | 68.4207547613,75.4837315082,633696.892914 97 | 85.5203909328,90.5134892367,853327.992118 98 | 99.7580081968,95.3025620813,704533.946535 99 | 79.8301905824,90.5353484046,647539.993538 100 | 95.4377389783,78.5523921623,660535.546645 101 | 48.0451993842,99.5340248374,858429.352443 102 | 87.034533141,73.2808360316,1123834.74847 103 | 93.9692821032,88.2121917816,614233.033997 104 | 87.5744254254,62.5044428601,606601.535578 105 | 67.4707425015,93.2998778808,896323.73988 106 | 76.5116181467,75.3360308005,819243.102833 107 | 88.4753837724,46.9377426165,665374.182069 108 | 98.3554251705,98.038632518,797395.800764 109 | 77.5337953799,97.4673001951,671774.397962 110 | 76.0468730996,99.9260512574,860854.207364 111 | 98.2686305131,81.3549993673,664310.324849 112 | 65.7747481864,88.2496136996,671210.804776 113 | 80.8825038552,49.8643681547,620721.55982 114 | 83.158548804,92.8723545472,1244424.25852 115 | 80.8036509092,95.8839082056,933374.183112 116 | 93.585101974,96.5319890404,1144160.5742 117 | 84.4987946421,58.4568356942,687386.256383 118 | 64.7982334652,42.44339284,633922.195263 119 | 82.6956032399,85.3146956993,690725.756456 120 | 79.1572027052,96.8100319393,1105114.48744 121 | 65.2436968866,87.3260694093,690377.23961 122 | 97.3784462962,88.9066440077,669844.693866 123 | 50.8561016514,99.4372475787,662029.8623 124 | 92.4114682475,78.7184886346,760603.046681 125 | 84.0127945314,96.5104511869,865411.062097 126 | 64.9572559174,88.187674508,668529.825669 127 | 93.1465697778,89.0709942237,716654.687563 128 | 85.4826083413,93.093393584,715805.491485 129 | 80.4091742371,92.9766402138,770535.487674 130 | 78.2889657011,78.3575617731,625463.528214 131 | 91.3520325801,99.6060769479,792265.290431 132 | 84.1878542852,88.1369195691,1014799.17765 133 | 74.0430405418,60.1493715741,681043.781573 134 | 79.1061015965,89.1989696664,901081.78969 135 | 73.7159607018,73.0784406306,756605.259203 136 | 70.7858854491,84.6622703349,601620.479438 137 | 74.6854503284,96.9299313608,708827.940735 138 | 50.4027077488,91.8656639636,636113.962999 139 | 95.8990871419,74.4689105548,1154572.9142 140 | 97.6247845868,67.0128305259,602757.589233 141 | 50.4056259893,87.5381467205,614116.594458 142 | 72.4250631226,47.3588830652,640758.204332 143 | 99.3247285717,93.7446020448,1069851.26872 144 | 74.9289733337,91.3277837948,657961.927249 145 | 71.9881160982,91.4935801704,686383.708384 146 | 61.7663793513,96.8280830107,710242.071215 147 | 90.6487030351,90.9007520924,977466.238582 148 | 72.2927995019,97.5628744271,623837.838824 149 | 98.2180838211,65.9941713882,629235.241334 150 | 72.239437316,94.2394155066,643880.178027 151 | 74.8736630482,86.1465154562,1395082.12401 152 | 83.9196011331,94.244909359,615340.148767 153 | 81.5988715091,93.3253328384,666669.948261 154 | 67.640726842,70.4357483882,739447.9202 155 | 79.7596108154,67.6934112724,866520.301749 156 | 56.7746477952,77.2399179804,782451.491414 157 | 97.1583470733,68.7782948121,621815.8547 158 | 94.8438032683,67.065915938,756837.092829 159 | 51.8592180476,96.0871381834,735973.940771 160 | 66.7152026539,74.8201190005,627325.303118 161 | 83.3482574998,64.4466635946,761823.597491 162 | 74.441923168,96.8836749306,604417.23591 163 | 70.7270619824,95.6241329485,642732.362139 164 | 78.8090270918,80.619492265,735770.825043 165 | 97.188777021,46.3905831076,718992.994967 166 | 93.290023655,66.6231879063,674283.095272 167 | 65.6702964458,82.1687452891,695588.881086 168 | 97.4635603741,98.8371040318,744660.347978 169 | 89.4751849742,52.9220541655,624127.264311 170 | 76.5062408514,72.2537205719,762731.829567 171 | 96.6516114682,96.2928441238,1318839.33593 172 | 87.2940243625,69.457557247,692446.736804 173 | 86.2633894422,77.7217118293,695471.647856 174 | 80.8293820797,72.2813430826,954071.332958 175 | 90.9830840994,81.5638782418,838653.552255 176 | 67.2291980807,84.8182815876,617312.204936 177 | 82.5520685092,95.3187775428,1380337.051 178 | 98.5423235293,74.2590896057,947929.242851 179 | 73.5429212514,97.5674435304,740979.840121 180 | 97.7803965091,99.8258273233,1168795.47903 181 | 92.1246636707,88.8140321859,601919.477888 182 | 43.4368161812,86.5630435268,965580.383958 183 | 91.668551783,71.6861040776,649662.233637 184 | 92.6381734926,89.6076275778,936841.337157 185 | 81.038480515,80.4153852081,912885.690703 186 | 89.9602657625,82.4920493386,904409.864501 187 | 89.3115190155,49.1455294399,986759.904155 188 | 55.098594531,98.8547801997,617176.733264 189 | 98.6874860979,81.1624029078,1596115.2343 190 | 38.8994504078,78.1026369376,602154.090594 191 | 50.1697038207,95.1427347988,798316.556136 192 | 70.2155016069,71.8851617007,672655.063352 193 | 71.0904998683,88.742089709,711738.334033 194 | 94.0980264378,75.1097996602,616980.524391 195 | 96.0248924561,64.2971734456,712169.42241 196 | 99.6240873659,74.9244706032,634122.468415 197 | 76.8370656025,69.7111065124,1050506.04385 198 | 66.9595294117,94.7018588418,769297.215528 199 | 91.0702743084,71.8040581828,693183.415125 200 | 96.6970968962,88.9911371308,649214.353493 201 | 91.719457114,47.0695130902,610409.592971 202 | 89.2088411274,72.0149836387,919405.924231 203 | 80.3915982574,58.3006680817,641132.993221 204 | 81.0487244799,90.1507582263,606113.119389 205 | 63.2525458248,99.2666333077,825861.09776 206 | 39.8101220224,94.8591624681,626929.894682 207 | 66.3980761283,90.1226324295,934681.719765 208 | 74.8933023863,85.7465823045,894785.777431 209 | 83.5831459331,37.1083646019,684500.478383 210 | 97.8442790258,49.1194299011,627756.306884 211 | 60.7573844292,87.5173780372,658145.629182 212 | 96.4248110125,73.6551944725,645498.266767 213 | 98.1023624809,34.0050442828,611655.348125 214 | 86.576135777,81.2028793092,733206.967568 215 | 68.1915978344,87.3670356374,754136.857921 216 | 84.738904195,98.2098722729,1026946.16223 217 | 76.8810846729,90.7876373977,768101.62961 218 | 97.8346243156,77.1234883572,928613.949132 219 | 56.0653998907,70.5276777734,921924.402628 220 | 71.3993139201,66.6612024092,673617.991983 221 | 95.62157529,94.4965491998,1246799.00542 222 | 85.217014001,91.9201919262,603055.537712 223 | 66.4372905638,92.0697315528,1043379.79283 224 | 90.6204751273,74.6658457036,896212.430975 225 | 38.7878656286,93.0808408085,620521.16784 226 | 77.2777689483,92.9619304944,741369.180503 227 | 93.8335906375,94.6910722074,869283.870097 228 | 80.7207064493,95.4679507031,955495.386676 229 | 98.4372343405,87.4421045089,1064490.22948 230 | 88.6507358997,94.2641562666,749115.462553 231 | 66.8246785683,82.1831889041,764822.954403 232 | 71.028004554,89.9095720948,706765.4461 233 | 93.3420238337,96.8194951309,830216.986786 234 | 73.6802034415,36.7673737983,617374.038093 235 | 83.7589312628,94.2901155064,685025.535873 236 | 93.8808290914,64.3194461114,1503095.50395 237 | 70.0480845406,80.7901382901,604396.836961 238 | 86.5969861645,95.4829330354,677312.847567 239 | 64.851236063,80.4615137093,882516.711113 240 | 98.4925488243,57.0712288018,727698.026322 241 | 82.4800932921,94.5045569507,704047.23911 242 | 95.8778194145,76.625230828,709664.569022 243 | 77.6637472404,93.0584227845,613681.102567 244 | 80.1650611013,51.3052215317,742761.751191 245 | 67.4222491526,59.5624825989,797073.331087 246 | 84.3985060859,88.6936972332,787428.278011 247 | 86.08557176,95.0229025551,669505.26742 248 | 96.3657335553,80.8239250613,711840.546604 249 | 41.4475377957,87.016750728,686080.283946 250 | 79.9302624518,61.9104249394,739238.517192 251 | 74.8981089009,72.1684506194,662252.42093 252 | 90.7442264209,60.4484554763,603105.776562 253 | 87.7785884501,56.6758797691,662134.080439 254 | 94.1654200522,71.6735052369,1199553.06752 255 | 70.6172239635,62.6561784289,1026472.74114 256 | 87.0118300648,94.5312532098,851511.003398 257 | 99.3864025367,76.6108098992,942965.132356 258 | 88.0343836711,80.1224057253,613058.996648 259 | 85.8130445843,95.2348146332,840760.443299 260 | 81.2915726521,85.248291081,624684.223991 261 | 92.9507448836,87.7034585794,872471.430148 262 | 87.6234933034,97.8390601172,813086.171932 263 | 90.7197111407,81.7209306024,998682.919204 264 | 67.2134646384,90.4640078467,1315210.07387 265 | 78.4286755653,88.6927508115,641929.438815 266 | 88.7976915111,78.4321550239,800704.739245 267 | 76.4499895614,95.2704160398,1409402.9915 268 | 66.3513939444,85.3779519194,818784.45259 269 | 73.1172125054,68.3717606587,679227.423055 270 | 71.8990335256,88.4798807256,637478.012533 271 | 74.2668081565,79.8228533703,788892.550137 272 | 91.7554563214,41.2465380105,613871.210772 273 | 62.8334095836,93.8332558616,847094.45929 274 | 79.5796877266,94.5001280876,883560.934644 275 | 79.7950679948,99.9217575379,1042451.60498 276 | 90.0657073171,75.7140049485,893030.507803 277 | 77.6783987435,90.666507572,977883.247752 278 | 89.791867617,94.0479547677,612171.180398 279 | 63.5498937539,64.9759374265,827715.531344 280 | 71.2977181895,60.4966751343,614494.733526 281 | 77.4976298605,73.887619074,632887.05254 282 | 92.9248883902,62.3139964952,1218282.48168 283 | 84.9233139105,73.3994226537,1066343.82091 284 | 60.614002916,88.3764787527,1282172.93073 285 | 77.9165538674,57.6413086408,747836.510552 286 | 96.8582197564,92.836866442,669613.411348 287 | 71.4583759194,95.383724882,633348.610475 288 | 78.8808178798,90.5556717544,694615.657981 289 | 47.7406532437,85.3891385047,701021.551014 290 | 67.1724285105,78.7344526563,858455.791721 291 | 88.3191576013,97.0953657014,608129.599988 292 | 78.3795845275,92.5633809625,959135.073995 293 | 69.6940314593,89.6279472522,1038009.2006 294 | 78.3991638537,62.2678783327,634385.874463 295 | 71.825611353,73.0095180994,1084345.05047 296 | 71.3050866659,67.0908581967,655818.78441 297 | 94.5042296795,87.6759589516,707611.451075 298 | 92.1902614738,66.2845762121,820467.395888 299 | 97.6118477034,32.8444407638,674096.991461 300 | 70.7336550291,92.3737059704,624408.734983 301 | 94.2246148983,86.8182662596,906210.688706 302 | 94.5146488885,61.7583668501,810404.999795 303 | 83.4075893282,79.6377693246,1054112.5794 304 | 77.3342737174,83.5400247177,776925.078337 305 | 88.7820737423,81.4882694822,1142810.63076 306 | 84.2350935033,58.4673482042,649848.495653 307 | 99.7256958301,49.3119506191,792130.729899 308 | 52.8265320418,99.5166462751,755844.833838 309 | 92.2054606512,78.8447041508,1044875.62377 310 | 93.6540911552,87.1864890452,776901.08004 311 | 71.3202643958,72.7555914534,805469.729435 312 | 75.1284765484,89.3656631748,693005.221872 313 | 98.4268656714,51.8842671556,917807.785071 314 | 65.1040047521,93.6084153585,694764.295034 315 | 55.9545257475,92.3671845689,647410.990887 316 | 74.6310518341,63.7613245144,742375.266641 317 | 85.8588052765,66.2906969103,669030.044999 318 | 83.7025968427,88.6117717203,797291.838152 319 | 54.8008231401,88.2230418928,601394.79009 320 | 85.4665047226,76.6465546652,909965.646307 321 | 65.6924289629,90.1729770424,813125.796778 322 | 58.4014390995,72.762485722,632512.514362 323 | 80.6594726055,52.5793018185,614545.324115 324 | 92.9015628431,86.5485395127,868187.85274 325 | 60.4002536179,94.8289373387,855902.833578 326 | 64.7341293898,89.3217781337,1277786.25658 327 | 80.4787089042,71.0361585774,642539.400264 328 | 84.4462969169,95.9313894563,878956.563342 329 | 71.2574149905,83.8368647301,868658.133526 330 | 79.6918697072,63.3960610695,604134.626177 331 | 65.5571900285,86.2992990319,824583.116698 332 | 78.2246919716,68.4717105314,617419.716936 333 | 85.5598670948,80.4798759011,1242404.16022 334 | 70.6139995605,55.3641113615,712787.16861 335 | 66.2050220755,84.9850668754,766445.508828 336 | 76.9480429585,79.7355488191,1008304.56658 337 | 90.407313802,89.8225353867,941785.437578 338 | 74.6056885866,72.1417182684,769934.73223 339 | 99.8107193947,93.5505478782,665616.82517 340 | 37.4280618506,97.5808558099,683946.5828 341 | 83.0441791504,82.785572179,1180464.87873 342 | 97.8212472679,68.944484761,1003294.7846 343 | 88.4271464225,93.61102033,742075.258318 344 | 99.6170226716,71.9889043446,678400.957294 345 | 93.8125001758,97.038041376,1011499.37834 346 | 88.7532103809,55.0896960525,685241.499028 347 | 93.6096216996,87.0835939884,792625.125973 348 | 87.7594138546,78.599263179,624775.593779 349 | 86.8404497112,90.3356832897,658346.038623 350 | 93.1701789421,92.6470167437,902903.430314 351 | 99.8928709425,70.4887484266,1477934.75492 352 | 50.6257426274,99.0429909226,653391.58058 353 | 70.4052764567,74.9764452006,614314.327809 354 | 98.1436284895,87.9542492333,849603.80054 355 | 79.1084516364,95.3257569852,783348.742371 356 | 92.3515153646,65.996371289,636963.542731 357 | 89.9678686205,89.8926586366,822129.239536 358 | 83.1624444395,90.0809026694,755865.791772 359 | 67.3602070389,92.3453141184,881536.266117 360 | 80.1585269893,67.2825856221,741527.487176 361 | 76.8579242697,95.0239097259,794553.104547 362 | 51.010496576,89.813541078,701484.692887 363 | 78.9471983512,85.4416881785,801626.620732 364 | 61.1277476082,96.276709363,678606.599177 365 | 48.3765549334,84.6964498537,784901.317874 366 | 83.6591713776,91.8754022311,661754.961676 367 | 53.9287332851,81.3069888625,732046.266692 368 | 62.481793973,88.5473689023,686219.343633 369 | 76.4108384763,66.7247729246,787921.872169 370 | 91.298340298,82.7959351018,765513.9295 371 | 73.3300359149,97.1725757563,603610.724979 372 | 92.2741309206,76.8124743199,616894.523499 373 | 35.1945643651,86.4627881255,609405.357946 374 | 87.534687725,54.2637313064,631132.734934 375 | 94.0437820438,84.5106936857,886426.135114 376 | 92.6569383071,99.5969599175,650952.043161 377 | 94.6189288926,84.66908448,1106871.45508 378 | 98.0528317465,89.4558187056,1434628.20201 379 | 88.9871649639,83.3256966729,713312.482431 380 | 88.0098339227,83.5663272586,1045789.69845 381 | 65.2270722851,82.9761741474,665710.381294 382 | 46.4841246416,99.8869749131,898059.159957 383 | 65.664770365,61.8024987932,607255.615377 384 | 93.1583201075,70.1609333316,653304.684654 385 | 86.6924528369,97.1343581666,819426.077281 386 | 65.8021159714,94.1023480299,625001.482115 387 | 75.407678397,71.7065185748,721743.009503 388 | 77.7498137134,49.311224258,763889.672897 389 | 71.6423408311,64.522928437,757406.418492 390 | 96.667017774,56.3299619439,611167.070435 391 | 92.7710274297,93.9591901548,797218.628587 392 | 80.3094818853,52.9887975434,650101.838745 393 | 41.7215146089,97.0718360181,603892.37448 394 | 46.1153261068,66.8780322815,611655.295301 395 | 77.7077542095,89.3178183797,1039830.69571 396 | 53.6292704956,97.3778543276,616973.944317 397 | 91.0192781392,62.3456753359,664639.916552 398 | 72.9084499611,88.913183185,728640.721171 399 | 97.0170182594,76.8002804276,678713.983518 400 | 97.4799338526,57.8657291905,732998.660106 401 | 76.5420229474,58.8169582344,683578.413859 402 | 92.6405126453,52.9516415507,705998.852907 403 | 66.2984942375,99.8969802951,726819.868835 404 | 86.1997576745,96.902724356,708459.322477 405 | 94.647471873,88.6815381135,758321.749451 406 | 98.6297261772,67.5270288254,660798.080699 407 | 67.4564535646,98.0417558398,881265.17461 408 | 71.3374221385,87.0338002369,606212.81992 409 | 63.3059684276,90.2573523862,883460.562533 410 | 95.2013939128,85.9142883525,900664.295657 411 | 73.7581491371,92.5899125925,619005.439436 412 | 54.2215878624,99.3035832976,611185.738382 413 | 92.802034647,60.9795335568,806652.036899 414 | 73.1035854413,67.8743960842,808462.966715 415 | 87.4612757427,90.2886446058,721987.206703 416 | 96.3526992052,90.7851143245,1175355.77727 417 | 89.5534565237,90.950778371,826972.315766 418 | 50.8799637654,51.6389475953,637769.515655 419 | 74.3363268327,99.0991168338,899632.339659 420 | 34.0059667584,81.3154639095,616548.708659 421 | 78.9941703829,56.6728077646,609849.866846 422 | 78.7958709306,82.6586934955,641819.380643 423 | 91.1320246175,96.9384846131,639452.206555 424 | 44.2770552788,80.7271095881,626941.234873 425 | 82.6049623644,79.2987550197,948509.060494 426 | 78.5787055674,79.4832042434,905565.075023 427 | 82.5965698822,97.6892729791,790892.303087 428 | 85.2463768614,99.8174084391,1225762.60787 429 | 74.1544730454,81.8239639293,885554.376728 430 | 87.1855073403,90.1455256174,1541811.99043 431 | 75.7500531842,48.0333400677,643557.557155 432 | 57.2434293567,84.4921507086,609003.958894 433 | 85.7602802192,65.3214809298,644859.941468 434 | 96.6689142567,81.9047783898,791078.786615 435 | 90.0547025242,90.7758264523,1052361.06237 436 | 93.455651319,78.623965273,1075395.16096 437 | 91.0289687592,77.937597951,1141237.81663 438 | 72.6531807481,97.875539671,806927.630057 439 | 70.3780562853,69.492970308,757567.446095 440 | 77.2863560532,96.4528590542,706594.820959 441 | 48.040103948,93.3907171606,947426.031752 442 | 81.1492499358,49.0888024332,853723.000252 443 | 79.235360977,81.6982796587,801586.483524 444 | 82.5127195318,77.7345655266,731899.803519 445 | 84.2702764453,94.1945063941,717073.679688 446 | 89.9900598336,96.2290835992,1251592.43303 447 | 90.3263791395,88.6569455368,666227.032114 448 | 79.1347292241,70.8821970483,823591.122731 449 | 53.2650617789,87.8517245741,684709.733865 450 | 91.6928749447,55.1221890666,751437.045917 451 | 91.7273131554,88.513331935,904407.187585 452 | 98.3422853968,97.7598997901,640231.852113 453 | 89.4163889942,71.9320925037,693411.064068 454 | 79.1221899252,76.7447007739,627340.449613 455 | 91.4333162131,70.1314198176,712417.214181 456 | 67.7133750049,93.4955036489,969177.806181 457 | 73.9884429722,80.7512484635,925181.496712 458 | 78.6045011205,83.1220913113,641733.606591 459 | 87.2900872765,60.7323952921,669490.259264 460 | 68.7323189715,66.6741724469,712057.98598 461 | 88.7930981522,96.1918779048,634154.242698 462 | 81.3693976169,72.5100468009,634588.506437 463 | 80.4812823521,86.2402447627,840240.895388 464 | 61.9230421149,81.7172372388,654102.457162 465 | 76.6337564274,93.1757560489,612102.961683 466 | 69.592727848,71.254450234,605117.440455 467 | 86.307736642,59.5820499647,663510.484402 468 | 92.1797762335,97.8773861578,764304.097475 469 | 52.2528629335,93.9824908973,855545.503914 470 | 96.8048407798,73.0015952314,1408088.20879 471 | 90.9023068824,57.11822431,640624.236928 472 | 81.7893103161,37.1867495367,638756.241559 473 | 64.819568996,89.6974220409,1031306.57558 474 | 82.5327849833,76.9170445618,615261.519434 475 | 86.7922693135,74.3467704351,915811.677807 476 | 64.5419351742,64.0594667972,619899.116826 477 | 98.7944186105,95.6974171037,797614.567534 478 | 68.6443133065,57.7373897954,691047.326209 479 | 97.9639505353,71.0696403262,793635.692012 480 | 93.2771056004,76.4605761857,744140.448693 481 | 87.8331331979,91.2963705004,1025506.58447 482 | 90.928717433,93.4395749685,619344.831252 483 | 62.7397322828,60.8903956131,648718.423834 484 | 95.989891418,78.3090625387,611426.532279 485 | 63.2429498664,93.9838749982,853105.134973 486 | 88.2103894569,99.1894491371,601512.070445 487 | 76.6590828768,80.9224543422,721653.49112 488 | 94.2274881897,60.5245066391,722919.137959 489 | 90.6588161486,77.8374205835,637777.134731 490 | 90.313866918,99.4268726673,863695.998826 491 | 73.7636673344,92.7171464969,858803.129619 492 | 84.6453539659,95.8729565735,1382605.64445 493 | 70.2104243931,99.5396649698,602833.985348 494 | 95.0183357893,93.6400942534,884404.715903 495 | 93.1267205445,54.4748519024,800732.199695 496 | 57.3228489059,80.9086439871,656511.527533 497 | 90.7972063681,92.7999040767,748078.924209 498 | 89.3530363206,74.3844496776,667103.711263 499 | 71.1705666849,89.3114389427,882427.794903 500 | 83.841485428,95.2354990804,1013148.09248 501 | 97.1583600886,37.0364133946,759508.834082 502 | 70.9064986919,75.7225091139,780109.05773 503 | 91.3043177606,44.7827410311,753369.136033 504 | 88.0960426212,81.0993434352,651105.352617 505 | 96.321795313,95.6172833475,880353.412268 506 | 95.4837531354,80.0389259606,1501186.07104 507 | 95.4903519606,99.6218472109,902006.063527 508 | 94.4285782484,96.5652173021,853295.028403 509 | 90.3505660022,81.4412362796,714391.056861 510 | 89.1345959698,91.6812962489,1105139.43222 511 | 80.9543394071,92.110140826,747793.007415 512 | 85.4756374948,93.8463348632,982454.379019 513 | 82.3540421955,82.5359393222,953506.06292 514 | 53.7550114759,92.9521013877,643596.209477 515 | 90.8982910699,84.8709414395,852131.122672 516 | 85.630656158,87.464871889,612143.365095 517 | 88.2047383981,65.3259804637,754486.354989 518 | 72.067171494,97.1473339581,1049223.22996 519 | 78.1469474874,65.5412302057,669872.824583 520 | 73.6905545438,94.5627046712,850006.026811 521 | 98.5453117418,86.5371545359,698156.125387 522 | 99.057688407,66.003992923,986152.618431 523 | 69.8884964018,79.1469105782,1021966.14118 524 | 98.1345877451,62.4566415483,608212.733329 525 | 72.8781325005,81.1223396784,851540.663069 526 | 82.882775533,75.4339523626,909594.790874 527 | 99.6110724132,99.5592981812,914946.221882 528 | 78.6863590922,69.618794038,927767.515737 529 | 86.2486816593,90.8499077817,878581.390555 530 | 62.7395098114,93.9658588589,770011.825526 531 | 48.8656878775,88.7212651649,783459.258311 532 | 99.6767011748,65.3333441314,692817.988647 533 | 61.5970058773,86.5782541593,712247.14077 534 | 95.2191733673,84.7770119554,608720.280965 535 | 92.1426147641,93.9622563559,614798.860329 536 | 50.2178292825,96.6085898721,613207.006722 537 | 88.5742863241,88.7617526813,1156823.54338 538 | 74.3295722557,87.6799975331,942443.103696 539 | 66.7126953004,87.0668266581,836811.858626 540 | 98.3779490691,61.9039697565,600195.155247 541 | 79.1427399253,96.2893558043,662648.174337 542 | 72.292367299,87.6975253845,633923.77427 543 | 74.8388278796,72.2432631509,746530.385083 544 | 52.4220525385,93.0579260177,641640.438131 545 | 93.958732038,74.5977467456,887249.879292 546 | 94.4135662678,87.7632593285,724943.715731 547 | 67.3818052621,89.2842541115,989858.5985 548 | 95.2606237129,56.6885680113,603925.051893 549 | 69.9964529921,86.3008576705,945440.942317 550 | 46.5597752832,81.1034809569,803901.125661 551 | 93.4735359208,84.1499049168,1420831.20546 552 | 51.8154618539,94.9166211205,707521.693004 553 | 80.2975065807,86.5616810911,842722.53121 554 | 79.6717446075,68.7944987334,648428.460204 555 | 76.5566094761,84.7023005234,602415.176457 556 | 77.674783465,83.7887649049,870879.739892 557 | 93.159322519,76.6914153817,713489.640019 558 | 94.7141887566,77.2709253705,679938.315109 559 | 91.0109306341,87.3911441945,1036208.2309 560 | 74.9612750523,87.8473873881,790192.516067 561 | 67.6659741757,70.418805583,685513.923044 562 | 93.7567979065,58.3345996426,663139.003687 563 | 76.5798214999,98.9712567861,616931.584526 564 | 51.1670796083,93.5562085887,603835.362715 565 | 83.0623499911,68.0955631412,944079.600607 566 | 95.368971673,49.774428847,623200.493752 567 | 77.4144117417,84.2696299884,722323.949598 568 | 95.7390772729,68.6060984368,843889.498202 569 | 99.608463456,81.1649235793,642837.92737 570 | 65.9304146571,61.1953661329,928580.050515 571 | 84.1532879051,97.8490136033,714886.067803 572 | 67.4616176056,61.1201238015,605558.474595 573 | 83.3334498032,87.7637115929,717168.815072 574 | 91.7164114617,98.0433895712,860640.574468 575 | 78.8462168188,78.4337840267,921963.926338 576 | 52.5215320015,63.2526831708,616467.625416 577 | 90.1598960525,87.1627416651,672359.609965 578 | 75.8659466971,56.6682920625,692800.424571 579 | 87.6772229374,74.7573552852,720502.416245 580 | 63.9191354383,65.8669912476,648865.446978 581 | 67.6976805796,88.0591662912,1230126.66442 582 | 79.3295585913,87.6848588819,615725.936021 583 | 93.8085892732,87.3026829811,848274.014011 584 | 87.6322776744,70.3026266036,650917.670359 585 | 94.0793053173,71.4423780061,829975.015778 586 | 95.0856900803,71.4947799517,715199.566991 587 | 78.4323399657,84.5891275005,948245.016652 588 | 94.8659996042,96.5019449129,947985.469885 589 | 82.2319909806,73.1701536902,676381.29742 590 | 81.716775844,79.9242951211,648541.398407 591 | 91.1530335936,84.0406391827,616660.516557 592 | 79.3263790035,59.5390934219,649605.024111 593 | 75.1320111475,99.491618625,862221.362918 594 | 81.7754758068,37.9638113667,690978.993198 595 | 59.8745218161,96.5158937257,717010.093333 596 | 81.8398459358,60.433571978,632874.775684 597 | 92.3018815459,95.3460892071,1081081.42228 598 | 94.6146758489,62.0090619711,1201974.87115 599 | 83.3301633227,98.473733377,855131.092808 600 | 75.3135967004,94.0340581086,885457.003456 601 | 98.5660615051,88.7408901935,997487.165633 602 | 76.0902878385,85.7657016425,988012.474536 603 | 94.0383026827,80.8379506697,890734.744141 604 | 75.3378226192,68.9656516292,827666.109626 605 | 86.53153892,95.7146054046,1026631.91358 606 | 65.6870290704,75.7653571995,648501.190661 607 | 98.8173808532,94.2415048363,929479.473729 608 | 87.2062718061,96.8739721479,655436.552611 609 | 43.5332368246,94.4217723733,614542.8113 610 | 98.3695548134,64.8973489134,798211.938733 611 | 79.7752625861,56.1902589882,634488.673488 612 | 81.9575549767,73.2339314175,992905.696851 613 | 78.2726960933,51.9793016312,685615.432825 614 | 98.4717880996,74.700977567,622875.551838 615 | 91.9587088112,90.1536193136,833742.614268 616 | 94.5676889889,69.7542881201,611414.946558 617 | 71.3571544233,83.6446006463,721789.291195 618 | 91.13930789,68.1597091856,743900.008738 619 | 75.4537488712,92.0696904246,803049.293398 620 | 78.0585553586,85.1283961333,752546.103441 621 | 65.3307590493,88.6309929616,798548.38726 622 | 86.1866533057,75.6392999707,609418.780875 623 | 99.8162876771,95.4816057872,615027.556846 624 | 79.4431291162,74.226666718,685661.343724 625 | 87.9919307253,88.3292815126,651560.073835 626 | 77.7635479546,71.9217742824,722873.095946 627 | 82.4193010654,98.035750794,822915.329339 628 | 36.6839624624,97.3864655411,665357.303537 629 | 91.4463761069,59.3708265342,627938.723361 630 | 71.5288068274,93.2579519372,1252613.43651 631 | 97.7362595197,78.523033431,1034603.66754 632 | 94.3722819851,63.2389897986,636537.580101 633 | 59.6229962916,80.6226928192,605985.489674 634 | 94.3335039894,85.9120303573,972253.985619 635 | 81.8844764967,90.5943675452,956210.751306 636 | 50.2985485572,96.5032880348,676592.035554 637 | 85.8845158025,66.7183183759,694657.734433 638 | 99.6922074377,53.176228727,615088.387085 639 | 77.9271041681,98.5346451498,830367.826454 640 | 71.5763480495,70.4212896775,695992.056864 641 | 73.0203943285,71.154092872,638604.148698 642 | 54.3674063103,91.7279498179,652513.990905 643 | 44.0023408374,80.2003343033,616069.049794 644 | 48.6729478034,84.9467633051,633286.038608 645 | 76.4842508886,91.4674950253,794026.160494 646 | 65.6954467455,94.0431507413,654701.72892 647 | 57.4601857403,85.3883690939,662254.811262 648 | 97.4241235725,70.7971059345,782688.037738 649 | 98.8423896826,80.0366007315,602495.986771 650 | 85.3304936533,65.9205591882,879338.075659 651 | 70.2648774306,98.399549481,636472.580344 652 | 56.2548559371,78.3816933384,843342.344997 653 | 90.3947394351,51.7260743159,994048.842585 654 | 64.0259682037,86.4444565021,1040758.53482 655 | 95.0590510988,73.3270305794,1069370.65649 656 | 74.426408447,91.5501549843,787604.883767 657 | 84.2574803686,62.164702346,844837.981149 658 | 81.0159184863,90.0404544469,1308556.83792 659 | 97.0197394539,72.304436109,1493041.67342 660 | 88.6523228762,31.9579973638,716080.416637 661 | 94.8872352231,70.9508574249,843208.21502 662 | 93.3673798924,96.9849216959,852075.027006 663 | 68.3257306384,87.8185951363,666903.972231 664 | 80.2874185657,75.0442679402,947542.189069 665 | 90.0223446882,83.7947515357,852853.221606 666 | 87.9723467438,76.1748414493,672925.290809 667 | 54.6214847024,87.2404536473,682353.79481 668 | 98.8015779408,69.8580670713,1228335.95445 669 | 96.2340056155,84.723164633,613809.684935 670 | 57.6135308133,97.149421867,795973.651912 671 | 83.2122411898,52.7691090368,845610.865127 672 | 91.4958856082,91.0500379853,705598.038203 673 | 72.0980483121,83.9165034263,842155.652644 674 | 57.7383049717,93.6381454476,616983.590689 675 | 51.6108636174,67.4223620929,634000.356218 676 | 77.6891638661,86.446219518,1147401.65432 677 | 68.0102229089,79.7063917572,755235.45983 678 | 97.3155926065,81.4105804502,901607.352995 679 | 97.0407358734,94.8633872046,1133017.85019 680 | 97.3851679557,92.8476837788,742301.959776 681 | 79.4823094866,85.3612426982,840272.910574 682 | 70.4327783807,87.3785415653,673790.67074 683 | 62.3823572329,94.5855787961,662992.257691 684 | 95.9496364943,85.20131277,638287.313062 685 | 88.4152779619,85.2168254544,748354.292364 686 | 82.6369750157,93.7070484134,819857.39244 687 | 72.5658452695,89.7723600852,678964.827555 688 | 71.074660038,74.8191332985,731241.722883 689 | 45.4606260165,86.1296276536,855460.647992 690 | 87.4839211867,91.1965746401,688466.092337 691 | 79.3139638573,91.0152510745,645291.7351 692 | 42.2214053673,94.7566937865,738828.4038 693 | 86.1551793937,83.2845121545,1085334.95648 694 | 96.2008255687,69.5627245551,843872.462319 695 | 83.9753705556,79.5361970523,756572.480664 696 | 46.2652128774,89.9631327688,807662.082031 697 | 80.752216544,68.4051535713,702205.756439 698 | 47.1527132237,90.5668964838,644777.105366 699 | 97.9323146543,86.9491381364,795672.415669 700 | 69.5428102052,99.3584376958,764664.175406 701 | 97.4596872692,63.1605638823,908584.677484 702 | 81.1769591168,88.3861162295,649350.157165 703 | 86.617409113,90.3210519978,683818.178075 704 | 55.3356973589,93.0050484117,844368.091679 705 | 80.3499608688,92.3667966252,803981.796762 706 | 75.948420716,63.6025538443,672145.766242 707 | 72.7708703187,84.98111943,859667.939441 708 | 95.5710345882,97.8738148957,799917.732212 709 | 69.3045361014,69.5972855322,685156.725068 710 | 98.8641638894,69.6200869018,1172931.05103 711 | 98.4137909388,63.7430740731,979501.87386 712 | 79.748042943,84.0997141507,644494.80495 713 | 91.430375443,72.6381928583,822092.274514 714 | 51.5921178958,82.3189976275,603923.339381 715 | 86.1251095562,82.4908128846,711767.846219 716 | 92.0748342488,87.8184411064,671101.533007 717 | 80.3880580855,56.232695576,647949.863147 718 | 57.167933306,85.6037936252,609916.621757 719 | 91.9657031077,75.3286409732,1294521.05164 720 | 54.3311184139,99.3323347637,618825.290308 721 | 91.0748923343,71.7870283407,679090.062317 722 | 41.0890570917,94.217710661,637644.535405 723 | 92.8773539606,77.1782149164,714868.982022 724 | 78.4995392636,70.0063400715,885627.595462 725 | 93.5498763612,83.7152010564,816640.633448 726 | 73.6008194097,50.101451407,782256.082345 727 | 78.0521260902,66.8135880253,692592.866371 728 | 93.1417252886,99.4938060126,682565.768456 729 | 48.9300843039,97.0852427393,604625.256935 730 | 88.6328534036,82.5421895964,1028058.96074 731 | 93.5997449288,65.2560870222,717596.960347 732 | 82.0834111973,69.0341081106,616517.298924 733 | 94.6777884533,96.1619540442,1131071.49935 734 | 95.4509969305,93.0147559453,1790636.22108 735 | 71.6189049459,71.014862599,702313.212714 736 | 49.4020310892,94.7878860653,729238.391383 737 | 99.2816356746,85.6222548466,825683.551575 738 | 63.38723189,90.4485269364,881145.1417 739 | 83.7745911746,99.1220296444,602170.117927 740 | 94.4642654563,78.3771009483,1067641.7595 741 | 88.9727246846,77.5608390685,677797.544499 742 | 95.4802592627,52.4104615097,641329.982298 743 | 85.9314473995,55.8073362775,687719.298396 744 | 79.8258780617,77.2423143229,751444.880492 745 | 78.1130212957,91.5862984272,700496.277063 746 | 74.167834963,92.1160913675,843212.962183 747 | 79.7097818648,64.7966468897,605673.705009 748 | 89.693979613,56.9537040312,1192203.58975 749 | 81.5748518727,56.8637132524,780999.03342 750 | 88.5875032544,78.8468951115,883524.468158 751 | 99.9098033825,58.1323954662,743954.064075 752 | 86.497645504,95.5770761987,806477.16096 753 | 95.9387471346,84.5517695897,866707.181692 754 | 88.2757951967,76.0868786544,1010499.16603 755 | 78.2863019213,96.6129755277,762418.221864 756 | 96.7652975436,93.293015766,754387.693956 757 | 65.4547317229,84.0773933932,1206609.90343 758 | 92.1997054734,66.6140913887,1025927.95329 759 | 87.8011786337,99.7183133993,776858.407843 760 | 81.910237182,57.5390953628,634058.31306 761 | 85.171290435,95.9544082854,612665.041794 762 | 66.0451274063,82.9949587343,676993.580233 763 | 79.6334265565,66.6935555682,699896.887598 764 | 61.4698939506,92.210681357,668270.017264 765 | 99.9316906737,96.0569875117,1221848.11889 766 | 57.4822851182,97.6918683064,751508.054754 767 | 67.6362848484,84.1371196313,759283.850373 768 | 98.4136063514,74.2025605784,603119.795537 769 | 99.0834001565,71.4847638559,892401.596569 770 | 95.7864980827,44.8219565995,662093.44485 771 | 92.6599876585,47.4403919885,931675.158438 772 | 79.8716553035,78.5633650917,741057.812409 773 | 71.4180922037,92.8170538764,693801.825199 774 | 66.3850209351,85.8788878209,757664.424722 775 | 86.7287576101,86.8503553647,727051.840226 776 | 91.2735909627,85.11150471,737708.711001 777 | 99.3880744466,87.0012306471,890146.179392 778 | 90.4585641808,90.2038160146,1054626.54243 779 | 88.0546658215,72.1330094246,773984.787393 780 | 83.1890823688,60.2071725294,689977.47479 781 | 65.0395433867,75.3547592968,696802.419233 782 | 83.656354295,87.2642219312,766503.99669 783 | 77.7531535291,85.1496484418,1073523.25039 784 | 59.343957477,80.3472649808,622597.693958 785 | 68.914631689,73.2343018513,704841.58712 786 | 86.0450431511,48.6095607417,851306.167151 787 | 82.3177076953,94.6943590807,664481.348398 788 | 77.7794147674,47.0341114943,659739.010412 789 | 56.9006527587,86.3743588127,813631.704912 790 | 81.8618551668,87.5467118401,754296.743321 791 | 90.6779590956,93.2660651066,1711027.752 792 | 76.363762502,88.6699403451,762386.928598 793 | 87.9573727322,99.8568147712,1346905.87185 794 | 68.1578094591,96.819745336,623525.824647 795 | 72.725547969,63.98932853,1199568.46796 796 | 95.7893564284,95.4825889594,628269.940675 797 | 93.7170321672,95.7235017022,783421.640388 798 | 83.235359428,90.9499801101,761815.590161 799 | 55.698762152,65.8479978328,637065.863946 800 | 71.7471902472,49.5267351008,616554.772204 801 | 85.4569132749,87.7406026266,759886.108606 802 | 98.4173836887,64.7241247066,701800.722191 803 | 61.5133915716,69.3628767163,785615.635499 804 | 67.2421726977,64.9338168732,643980.872052 805 | 83.8790468368,85.2455673378,605339.685789 806 | 75.3022169777,71.8711641156,1118464.76367 807 | 91.7853508462,92.3652179627,968617.087685 808 | 77.8865195773,98.8227201947,701279.677881 809 | 46.1969265713,96.747855452,602785.028839 810 | 95.7979370388,88.518829109,1198229.44893 811 | 70.8383071633,82.2965248044,893506.380784 812 | 88.4817916185,99.0339605056,872317.062814 813 | 88.5212850515,86.1712758931,631675.254903 814 | 66.7900811305,97.7465969991,632894.087487 815 | 93.7633560972,78.3818962521,846055.167217 816 | 98.1229112408,95.3936328677,698908.206377 817 | 51.0183674818,94.6243732903,637918.24627 818 | 62.0049529192,92.1245569971,661806.840622 819 | 70.6345908844,76.7541982349,626818.875665 820 | 93.199998276,76.867030287,677753.985615 821 | 87.3083027275,78.7226725638,1010951.50911 822 | 87.9134794091,62.7601312818,663987.084124 823 | 84.296878407,88.9279358751,909949.93319 824 | 54.2755503498,76.6656558499,680196.656932 825 | 91.9012653846,46.3983355745,655370.666949 826 | 88.1114258126,38.4840970541,797791.321595 827 | 97.0839923052,49.4033218572,633367.943567 828 | 81.5868810704,87.0724113294,1075511.50225 829 | 81.0363316412,60.3147977022,765365.177905 830 | 83.6232007534,83.3777075523,623970.334737 831 | 88.5030598001,84.6939275774,1000423.36435 832 | 46.7640694309,80.5237807693,728921.206611 833 | 81.7923418912,83.964576528,1212087.08474 834 | 87.9990140684,64.731646034,943134.844484 835 | 78.5154267615,46.8519253015,623412.2627 836 | 85.9540474921,93.9232918495,705195.529581 837 | 61.4698601531,88.9837000045,669997.92124 838 | 94.6117021353,74.4624471142,1238075.31937 839 | 50.7227663591,66.5574470141,725637.577603 840 | 67.2681146107,91.6670432465,668296.293284 841 | 53.5697095401,92.4256865851,681553.729424 842 | 91.4430212422,79.0145371282,887443.425254 843 | 92.3231751131,78.8568010302,945527.577919 844 | 55.7037571906,77.7799736635,752256.542612 845 | 89.0359684276,72.1977580445,633744.226741 846 | 84.747883797,78.681262004,932815.201485 847 | 80.5312042325,93.1012723997,633492.475268 848 | 88.804909075,71.6880572698,754474.242304 849 | 94.8912619813,70.6977490293,605826.349638 850 | 82.0188512946,79.6261384803,796984.322775 851 | 91.0778541273,70.157901782,618510.852169 852 | 87.81448711,89.4301090339,889857.581579 853 | 37.0288282333,85.8933824906,609164.119232 854 | 75.6810405526,91.060640141,872263.514834 855 | 86.0924931297,87.2933704983,833793.531284 856 | 82.4154792501,87.5223102475,664388.091885 857 | 87.8706193101,42.6681418772,1157684.62926 858 | 75.6754322559,90.9890787289,621424.513474 859 | 98.3724383685,95.9192884671,1155338.61006 860 | 39.6855621298,86.0356658162,795159.043665 861 | 62.4390727849,64.4600878793,621532.723846 862 | 51.364858304,94.6337443362,786658.650426 863 | 87.1283155257,96.1748246581,636676.544394 864 | 73.9352472402,60.555585272,706681.522313 865 | 97.384616535,94.30374936,1142953.08948 866 | 66.0627648543,99.7282478321,619147.736971 867 | 92.8294867885,52.9496676839,719404.304582 868 | 89.5989009962,90.860257307,807736.769154 869 | 80.7953556321,90.2139048758,683996.766202 870 | 94.4504150471,50.3743937164,783340.777588 871 | 83.074319546,91.6889174215,830531.806462 872 | 80.3474727353,63.7431558673,738760.085414 873 | 92.7419934179,98.2898145905,787314.551933 874 | 75.2302867892,89.6585551779,756978.967101 875 | 83.097398057,60.1474435337,796462.087446 876 | 76.4164861468,95.851265874,617914.50565 877 | 79.2103344824,68.2910467583,941892.525158 878 | 58.9390364099,72.8130934313,625482.244407 879 | 96.2015198293,77.1152910215,894415.429347 880 | 97.3326315828,66.493081347,721245.934771 881 | 43.3864812868,77.1453378164,643779.38295 882 | 73.1611657959,94.9429473147,637393.954796 883 | 90.7442208394,83.0028683605,629018.832671 884 | 86.9440255499,92.0197059311,863426.0268 885 | 94.3848610127,90.5322317238,800487.830594 886 | 92.2560025867,81.4976442258,833930.656391 887 | 94.6830880991,95.5817615788 -------------------------------------------------------------------------------- /monteCarloFinal1.py: -------------------------------------------------------------------------------- 1 | import random 2 | import matplotlib 3 | import matplotlib.pyplot as plt 4 | import time 5 | 6 | 7 | ''' 8 | def rollDice(): 9 | roll = random.randint(1,100) 10 | 11 | if roll == 100: 12 | #print roll,'roll was 100, you lose. What are the odds?! Play again!' 13 | return False 14 | elif roll <= 50: 15 | #print roll,'roll was 1-50, you lose. Play again!' 16 | return False 17 | 18 | elif 100 > roll > 50: 19 | #print roll,'roll was 51-99, you win! *pretty lights flash* Play more!' 20 | return True 21 | ''' 22 | 23 | 24 | def rollDice(): 25 | roll = random.randint(1,100) 26 | 27 | if roll <= 50: 28 | #print roll,'roll was 1-50, you lose. Play again!' 29 | return False 30 | 31 | elif roll >= 51: 32 | #print roll,'roll was 51-99, you win! *pretty lights flash* Play more!' 33 | return True 34 | 35 | def dAlembert(funds,initial_wager,wager_count): 36 | 37 | global Ret 38 | global da_busts 39 | global da_profits 40 | 41 | value = funds 42 | wager = initial_wager 43 | currentWager = 1 44 | previousWager = 'win' 45 | previousWagerAmount = initial_wager 46 | 47 | while currentWager <= wager_count: 48 | if previousWager == 'win': 49 | if wager == initial_wager: 50 | pass 51 | else: 52 | wager -= initial_wager 53 | 54 | #print 'current wager:',wager,'value:',value 55 | 56 | if rollDice(): 57 | value += wager 58 | #print 'we won, current value:',value 59 | previousWagerAmount = wager 60 | else: 61 | value -= wager 62 | previousWager = 'loss' 63 | #print 'we lost, current value',value 64 | previousWagerAmount = wager 65 | 66 | if value <= 0: 67 | da_busts += 1 68 | break 69 | 70 | elif previousWager == 'loss': 71 | wager = previousWagerAmount + initial_wager 72 | if (value - wager) <= 0: 73 | wager = value 74 | 75 | #print 'lost the last wager, current wager:',wager,'value',value 76 | 77 | 78 | if rollDice(): 79 | value += wager 80 | #print 'we won, current value:',value 81 | previousWagerAmount = wager 82 | previousWager = 'win' 83 | 84 | else: 85 | value -= wager 86 | #print 'we lost, current value:',value 87 | previousWagerAmount = wager 88 | 89 | if value <= 0: 90 | da_busts += 1 91 | break 92 | currentWager += 1 93 | 94 | if value > funds: 95 | da_profits += 1 96 | 97 | #print value 98 | 99 | Ret += value 100 | 101 | def multiple_bettor(funds, initial_wager, wager_count): 102 | global multiple_busts 103 | global multiple_profits 104 | 105 | value = funds 106 | wager = initial_wager 107 | wX = [] 108 | vY = [] 109 | 110 | currentWager = 1 111 | previousWager = 'win' 112 | previousWagerAmount = initial_wager 113 | 114 | while currentWager <= wager_count: 115 | if previousWager == 'win': 116 | #print 'we won the last wager, great' 117 | if rollDice(): 118 | value+=wager 119 | #print value 120 | wX.append(currentWager) 121 | vY.append(value) 122 | else: 123 | value -= wager 124 | previousWager = 'loss' 125 | #print value 126 | previousWagerAmount = wager 127 | wX.append(currentWager) 128 | vY.append(value) 129 | if value <= 0: 130 | #print 'we went broke after'.currentWager,'bets' 131 | multiple_busts += 1 132 | break 133 | 134 | 135 | elif previousWager == 'loss': 136 | #print 'we lost the last one, so we will be smart and double' 137 | if rollDice(): 138 | wager = previousWagerAmount * random_multiple 139 | 140 | if (value - wager) < 0: 141 | wager = value 142 | #print 'we won',wager 143 | value += wager 144 | #print value 145 | wager = initial_wager 146 | previousWager = 'win' 147 | wX.append(currentWager) 148 | vY.append(value) 149 | else: 150 | wager = previousWagerAmount * random_multiple 151 | if (value - wager) < 0: 152 | wager = value 153 | #print 'we lost',wager 154 | value -= wager 155 | previousWagerAmount = wager 156 | wX.append(currentWager) 157 | vY.append(value) 158 | if value <= 0: 159 | #print 'we went broke after',currentWager,'bets' 160 | multiple_busts += 1 161 | break 162 | 163 | #print value 164 | previousWager = 'loss' 165 | 166 | 167 | 168 | 169 | currentWager += 1 170 | 171 | #print value 172 | #plt.plot(wX,vY,color) 173 | if value > funds: 174 | multiple_profits += 1 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | def doubler_bettor(funds, initial_wager, wager_count,color): 186 | value = funds 187 | wager = initial_wager 188 | global doubler_busts 189 | global doubler_profits 190 | wX = [] 191 | vY = [] 192 | 193 | currentWager = 1 194 | previousWager = 'win' 195 | previousWagerAmount = initial_wager 196 | 197 | while currentWager <= wager_count: 198 | if previousWager == 'win': 199 | #print 'we won the last wager, great' 200 | if rollDice(): 201 | value+=wager 202 | #print value 203 | wX.append(currentWager) 204 | vY.append(value) 205 | else: 206 | value -= wager 207 | previousWager = 'loss' 208 | #print value 209 | previousWagerAmount = wager 210 | wX.append(currentWager) 211 | vY.append(value) 212 | if value <= 0: 213 | #print 'we went broke after'.currentWager,'bets' 214 | doubler_busts += 1 215 | break 216 | 217 | 218 | elif previousWager == 'loss': 219 | #print 'we lost the last one, so we will be smart and double' 220 | if rollDice(): 221 | wager = previousWagerAmount * 2 222 | 223 | if (value - wager) < 0: 224 | wager = value 225 | #print 'we won',wager 226 | value += wager 227 | #print value 228 | wager = initial_wager 229 | previousWager = 'win' 230 | wX.append(currentWager) 231 | vY.append(value) 232 | else: 233 | wager = previousWagerAmount * 2 234 | if (value - wager) < 0: 235 | wager = value 236 | #print 'we lost',wager 237 | value -= wager 238 | previousWagerAmount = wager 239 | wX.append(currentWager) 240 | vY.append(value) 241 | if value <= 0: 242 | #print 'we went broke after',currentWager,'bets' 243 | doubler_busts += 1 244 | break 245 | 246 | #print value 247 | previousWager = 'loss' 248 | 249 | 250 | 251 | 252 | currentWager += 1 253 | 254 | #print value 255 | plt.plot(wX,vY,color) 256 | if value > funds: 257 | doubler_profits += 1 258 | 259 | 260 | def simple_bettor(funds, initial_wager, wager_count,color): 261 | global simple_busts 262 | global simple_profits 263 | value = funds 264 | wager = initial_wager 265 | 266 | wX = [] 267 | vY = [] 268 | 269 | currentWager = 1 270 | 271 | while currentWager <= wager_count: 272 | if rollDice(): 273 | value += wager 274 | wX.append(currentWager) 275 | vY.append(value) 276 | else: 277 | value -= wager 278 | wX.append(currentWager) 279 | vY.append(value) 280 | 281 | currentWager += 1 282 | 283 | if value <= 0: 284 | value = 0 285 | simple_busts+=1 286 | #print 'Funds:', value 287 | 288 | plt.plot(wX,vY,color) 289 | if value > funds: 290 | value = 0 291 | simple_profits+=1 292 | 293 | 294 | 295 | #lower_bust = 31.235 296 | #higher_profit = 63.208 297 | 298 | sampleSize = 1000 299 | startingFunds = 10000 300 | 301 | 302 | mainCounter = 1 303 | sizes = [] 304 | counts = [] 305 | 306 | while True: 307 | 308 | 309 | ###################### 310 | #wagerSize = 100 311 | #wagerCount = 100 312 | wagerSize = random.uniform(1.0,100.00) 313 | wagerCount = random.uniform(1.0,100.00) 314 | ###################### 315 | Ret = 0.0 316 | da_profits = 0.0 317 | da_busts = 0.0 318 | daSampSize = 10000 319 | counter = 1 320 | ###################### 321 | while counter <= daSampSize: 322 | dAlembert(startingFunds,wagerSize,wagerCount) 323 | counter+=1 324 | ROI = Ret - (daSampSize*startingFunds) 325 | if ROI > 600000: 326 | print '_________________________' 327 | print 'wagerSize',wagerSize 328 | print 'wagerCount',wagerCount 329 | print 'Total invested:',daSampSize*startingFunds 330 | print 'Total Return:', Ret 331 | print 'ROI',Ret - (daSampSize*startingFunds) 332 | print 'Bust Rate:',(da_busts/daSampSize)*100.00 333 | print 'Profit rate:',(da_profits/daSampSize)*100.00 334 | 335 | saveFile = open('dataResults.csv','a') 336 | writeLine = '\n'+str(wagerSize)+','+str(wagerCount)+','+str(Ret - (daSampSize*startingFunds)) 337 | saveFile.write(writeLine) 338 | saveFile.close() 339 | 340 | print 'currently on:',mainCounter 341 | 342 | else: 343 | pass 344 | ''' 345 | print 'wagerSize',wagerSize 346 | print 'wagerCount',wagerCount 347 | print 'Total invested:',daSampSize*startingFunds 348 | print 'Total Return:', Ret 349 | print 'ROI',Ret - (daSampSize*startingFunds) 350 | print 'Bust Rate:',(da_busts/daSampSize)*100.00 351 | print 'Profit rate:',(da_profits/daSampSize)*100.00 352 | ''' 353 | mainCounter += 1 354 | 355 | 356 | 357 | 358 | 359 | 360 | '''plt.scatter(sizes,counts) 361 | plt.xlabel('Sizes') 362 | plt.ylabel('Counts') 363 | plt.savefig('montecarloyo.png') 364 | plt.show()''' 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | -------------------------------------------------------------------------------- /monteCarloFinal2.py: -------------------------------------------------------------------------------- 1 | import random 2 | import matplotlib 3 | import matplotlib.pyplot as plt 4 | import time 5 | 6 | 7 | ''' 8 | def rollDice(): 9 | roll = random.randint(1,100) 10 | 11 | if roll == 100: 12 | #print roll,'roll was 100, you lose. What are the odds?! Play again!' 13 | return False 14 | elif roll <= 50: 15 | #print roll,'roll was 1-50, you lose. Play again!' 16 | return False 17 | 18 | elif 100 > roll > 50: 19 | #print roll,'roll was 51-99, you win! *pretty lights flash* Play more!' 20 | return True 21 | ''' 22 | 23 | 24 | def rollDice(): 25 | roll = random.randint(1,100) 26 | 27 | if roll <= 50: 28 | #print roll,'roll was 1-50, you lose. Play again!' 29 | return False 30 | 31 | elif roll >= 51: 32 | #print roll,'roll was 51-99, you win! *pretty lights flash* Play more!' 33 | return True 34 | 35 | def dAlembert(funds,initial_wager,wager_count): 36 | 37 | global Ret 38 | global da_busts 39 | global da_profits 40 | 41 | value = funds 42 | wager = initial_wager 43 | currentWager = 1 44 | previousWager = 'win' 45 | previousWagerAmount = initial_wager 46 | 47 | while currentWager <= wager_count: 48 | if previousWager == 'win': 49 | if wager == initial_wager: 50 | pass 51 | else: 52 | wager -= initial_wager 53 | 54 | #print 'current wager:',wager,'value:',value 55 | 56 | if rollDice(): 57 | value += wager 58 | #print 'we won, current value:',value 59 | previousWagerAmount = wager 60 | else: 61 | value -= wager 62 | previousWager = 'loss' 63 | #print 'we lost, current value',value 64 | previousWagerAmount = wager 65 | 66 | if value <= 0: 67 | da_busts += 1 68 | break 69 | 70 | elif previousWager == 'loss': 71 | wager = previousWagerAmount + initial_wager 72 | if (value - wager) <= 0: 73 | wager = value 74 | 75 | #print 'lost the last wager, current wager:',wager,'value',value 76 | 77 | 78 | if rollDice(): 79 | value += wager 80 | #print 'we won, current value:',value 81 | previousWagerAmount = wager 82 | previousWager = 'win' 83 | 84 | else: 85 | value -= wager 86 | #print 'we lost, current value:',value 87 | previousWagerAmount = wager 88 | 89 | if value <= 0: 90 | da_busts += 1 91 | break 92 | currentWager += 1 93 | 94 | if value > funds: 95 | da_profits += 1 96 | 97 | #print value 98 | 99 | Ret += value 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | def multiple_bettor(funds, initial_wager, wager_count): 139 | global multiple_busts 140 | global multiple_profits 141 | 142 | value = funds 143 | wager = initial_wager 144 | wX = [] 145 | vY = [] 146 | 147 | currentWager = 1 148 | previousWager = 'win' 149 | previousWagerAmount = initial_wager 150 | 151 | while currentWager <= wager_count: 152 | if previousWager == 'win': 153 | #print 'we won the last wager, great' 154 | if rollDice(): 155 | value+=wager 156 | #print value 157 | wX.append(currentWager) 158 | vY.append(value) 159 | else: 160 | value -= wager 161 | previousWager = 'loss' 162 | #print value 163 | previousWagerAmount = wager 164 | wX.append(currentWager) 165 | vY.append(value) 166 | if value <= 0: 167 | #print 'we went broke after'.currentWager,'bets' 168 | multiple_busts += 1 169 | break 170 | 171 | 172 | elif previousWager == 'loss': 173 | #print 'we lost the last one, so we will be smart and double' 174 | if rollDice(): 175 | wager = previousWagerAmount * random_multiple 176 | 177 | if (value - wager) < 0: 178 | wager = value 179 | #print 'we won',wager 180 | value += wager 181 | #print value 182 | wager = initial_wager 183 | previousWager = 'win' 184 | wX.append(currentWager) 185 | vY.append(value) 186 | else: 187 | wager = previousWagerAmount * random_multiple 188 | if (value - wager) < 0: 189 | wager = value 190 | #print 'we lost',wager 191 | value -= wager 192 | previousWagerAmount = wager 193 | wX.append(currentWager) 194 | vY.append(value) 195 | if value <= 0: 196 | #print 'we went broke after',currentWager,'bets' 197 | multiple_busts += 1 198 | break 199 | 200 | #print value 201 | previousWager = 'loss' 202 | 203 | 204 | 205 | 206 | currentWager += 1 207 | 208 | #print value 209 | #plt.plot(wX,vY,color) 210 | if value > funds: 211 | multiple_profits += 1 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | def doubler_bettor(funds, initial_wager, wager_count,color): 223 | value = funds 224 | wager = initial_wager 225 | global doubler_busts 226 | global doubler_profits 227 | wX = [] 228 | vY = [] 229 | 230 | currentWager = 1 231 | previousWager = 'win' 232 | previousWagerAmount = initial_wager 233 | 234 | while currentWager <= wager_count: 235 | if previousWager == 'win': 236 | #print 'we won the last wager, great' 237 | if rollDice(): 238 | value+=wager 239 | #print value 240 | wX.append(currentWager) 241 | vY.append(value) 242 | else: 243 | value -= wager 244 | previousWager = 'loss' 245 | #print value 246 | previousWagerAmount = wager 247 | wX.append(currentWager) 248 | vY.append(value) 249 | if value <= 0: 250 | #print 'we went broke after'.currentWager,'bets' 251 | doubler_busts += 1 252 | break 253 | 254 | 255 | elif previousWager == 'loss': 256 | #print 'we lost the last one, so we will be smart and double' 257 | if rollDice(): 258 | wager = previousWagerAmount * 2 259 | 260 | if (value - wager) < 0: 261 | wager = value 262 | #print 'we won',wager 263 | value += wager 264 | #print value 265 | wager = initial_wager 266 | previousWager = 'win' 267 | wX.append(currentWager) 268 | vY.append(value) 269 | else: 270 | wager = previousWagerAmount * 2 271 | if (value - wager) < 0: 272 | wager = value 273 | #print 'we lost',wager 274 | value -= wager 275 | previousWagerAmount = wager 276 | wX.append(currentWager) 277 | vY.append(value) 278 | if value <= 0: 279 | #print 'we went broke after',currentWager,'bets' 280 | doubler_busts += 1 281 | break 282 | 283 | #print value 284 | previousWager = 'loss' 285 | 286 | 287 | 288 | 289 | currentWager += 1 290 | 291 | #print value 292 | plt.plot(wX,vY,color) 293 | if value > funds: 294 | doubler_profits += 1 295 | 296 | 297 | def simple_bettor(funds, initial_wager, wager_count,color): 298 | global simple_busts 299 | global simple_profits 300 | value = funds 301 | wager = initial_wager 302 | 303 | wX = [] 304 | vY = [] 305 | 306 | currentWager = 1 307 | 308 | while currentWager <= wager_count: 309 | if rollDice(): 310 | value += wager 311 | wX.append(currentWager) 312 | vY.append(value) 313 | else: 314 | value -= wager 315 | wX.append(currentWager) 316 | vY.append(value) 317 | 318 | currentWager += 1 319 | 320 | if value <= 0: 321 | value = 0 322 | simple_busts+=1 323 | #print 'Funds:', value 324 | 325 | plt.plot(wX,vY,color) 326 | if value > funds: 327 | value = 0 328 | simple_profits+=1 329 | 330 | 331 | 332 | #lower_bust = 31.235 333 | #higher_profit = 63.208 334 | 335 | sampleSize = 1000 336 | startingFunds = 10000 337 | 338 | 339 | mainCounter = 1 340 | sizes = [] 341 | counts = [] 342 | 343 | while True: 344 | 345 | 346 | ###################### 347 | #wagerSize = 100 348 | #wagerCount = 100 349 | wagerSize = random.uniform(1.0,100.00) 350 | wagerCount = random.uniform(1.0,100.00) 351 | ###################### 352 | Ret = 0.0 353 | da_profits = 0.0 354 | da_busts = 0.0 355 | daSampSize = 10000 356 | counter = 1 357 | ###################### 358 | while counter <= daSampSize: 359 | dAlembert(startingFunds,wagerSize,wagerCount) 360 | counter+=1 361 | ROI = Ret - (daSampSize*startingFunds) 362 | if ROI > 600000: 363 | print '_________________________' 364 | print 'wagerSize',wagerSize 365 | print 'wagerCount',wagerCount 366 | print 'Total invested:',daSampSize*startingFunds 367 | print 'Total Return:', Ret 368 | print 'ROI',Ret - (daSampSize*startingFunds) 369 | print 'Bust Rate:',(da_busts/daSampSize)*100.00 370 | print 'Profit rate:',(da_profits/daSampSize)*100.00 371 | 372 | saveFile = open('dataResults.csv','a') 373 | writeLine = '\n'+str(wagerSize)+','+str(wagerCount) 374 | saveFile.write(writeLine) 375 | saveFile.close() 376 | 377 | print 'currently on:',mainCounter 378 | 379 | else: 380 | pass 381 | ''' 382 | print 'wagerSize',wagerSize 383 | print 'wagerCount',wagerCount 384 | print 'Total invested:',daSampSize*startingFunds 385 | print 'Total Return:', Ret 386 | print 'ROI',Ret - (daSampSize*startingFunds) 387 | print 'Bust Rate:',(da_busts/daSampSize)*100.00 388 | print 'Profit rate:',(da_profits/daSampSize)*100.00 389 | ''' 390 | mainCounter += 1 391 | 392 | 393 | 394 | 395 | 396 | 397 | '''plt.scatter(sizes,counts) 398 | plt.xlabel('Sizes') 399 | plt.ylabel('Counts') 400 | plt.savefig('montecarloyo.png') 401 | plt.show()''' 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | -------------------------------------------------------------------------------- /monteCarloTutorial.py: -------------------------------------------------------------------------------- 1 | import random 2 | import matplotlib 3 | import matplotlib.pyplot as plt 4 | import time 5 | 6 | 7 | ''' 8 | def rollDice(): 9 | roll = random.randint(1,100) 10 | 11 | if roll == 100: 12 | #print roll,'roll was 100, you lose. What are the odds?! Play again!' 13 | return False 14 | elif roll <= 50: 15 | #print roll,'roll was 1-50, you lose. Play again!' 16 | return False 17 | 18 | elif 100 > roll > 50: 19 | #print roll,'roll was 51-99, you win! *pretty lights flash* Play more!' 20 | return True 21 | ''' 22 | 23 | 24 | def rollDice(): 25 | roll = random.randint(1,100) 26 | 27 | if roll <= 50: 28 | #print roll,'roll was 1-50, you lose. Play again!' 29 | return False 30 | 31 | elif roll >= 51: 32 | #print roll,'roll was 51-99, you win! *pretty lights flash* Play more!' 33 | return True 34 | 35 | def dAlembert(funds,initial_wager,wager_count): 36 | 37 | global Ret 38 | global da_busts 39 | global da_profits 40 | 41 | value = funds 42 | wager = initial_wager 43 | currentWager = 1 44 | previousWager = 'win' 45 | previousWagerAmount = initial_wager 46 | 47 | while currentWager <= wager_count: 48 | if previousWager == 'win': 49 | if wager == initial_wager: 50 | pass 51 | else: 52 | wager -= initial_wager 53 | 54 | #print 'current wager:',wager,'value:',value 55 | 56 | if rollDice(): 57 | value += wager 58 | #print 'we won, current value:',value 59 | previousWagerAmount = wager 60 | else: 61 | value -= wager 62 | previousWager = 'loss' 63 | #print 'we lost, current value',value 64 | previousWagerAmount = wager 65 | 66 | if value <= 0: 67 | da_busts += 1 68 | break 69 | 70 | elif previousWager == 'loss': 71 | wager = previousWagerAmount + initial_wager 72 | if (value - wager) <= 0: 73 | wager = value 74 | 75 | #print 'lost the last wager, current wager:',wager,'value',value 76 | 77 | 78 | if rollDice(): 79 | value += wager 80 | #print 'we won, current value:',value 81 | previousWagerAmount = wager 82 | previousWager = 'win' 83 | 84 | else: 85 | value -= wager 86 | #print 'we lost, current value:',value 87 | previousWagerAmount = wager 88 | 89 | if value <= 0: 90 | da_busts += 1 91 | break 92 | currentWager += 1 93 | 94 | if value > funds: 95 | da_profits += 1 96 | 97 | #print value 98 | 99 | Ret += value 100 | 101 | 102 | 103 | 104 | 105 | def multiple_bettor(funds, initial_wager, wager_count): 106 | global multiple_busts 107 | global multiple_profits 108 | 109 | value = funds 110 | wager = initial_wager 111 | wX = [] 112 | vY = [] 113 | 114 | currentWager = 1 115 | previousWager = 'win' 116 | previousWagerAmount = initial_wager 117 | 118 | while currentWager <= wager_count: 119 | if previousWager == 'win': 120 | #print 'we won the last wager, great' 121 | if rollDice(): 122 | value+=wager 123 | #print value 124 | wX.append(currentWager) 125 | vY.append(value) 126 | else: 127 | value -= wager 128 | previousWager = 'loss' 129 | #print value 130 | previousWagerAmount = wager 131 | wX.append(currentWager) 132 | vY.append(value) 133 | if value <= 0: 134 | #print 'we went broke after'.currentWager,'bets' 135 | multiple_busts += 1 136 | break 137 | 138 | 139 | elif previousWager == 'loss': 140 | #print 'we lost the last one, so we will be smart and double' 141 | if rollDice(): 142 | wager = previousWagerAmount * random_multiple 143 | 144 | if (value - wager) < 0: 145 | wager = value 146 | #print 'we won',wager 147 | value += wager 148 | #print value 149 | wager = initial_wager 150 | previousWager = 'win' 151 | wX.append(currentWager) 152 | vY.append(value) 153 | else: 154 | wager = previousWagerAmount * random_multiple 155 | if (value - wager) < 0: 156 | wager = value 157 | #print 'we lost',wager 158 | value -= wager 159 | previousWagerAmount = wager 160 | wX.append(currentWager) 161 | vY.append(value) 162 | if value <= 0: 163 | #print 'we went broke after',currentWager,'bets' 164 | multiple_busts += 1 165 | break 166 | 167 | #print value 168 | previousWager = 'loss' 169 | 170 | 171 | 172 | 173 | currentWager += 1 174 | 175 | #print value 176 | #plt.plot(wX,vY,color) 177 | if value > funds: 178 | multiple_profits += 1 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | def doubler_bettor(funds, initial_wager, wager_count,color): 190 | value = funds 191 | wager = initial_wager 192 | global doubler_busts 193 | global doubler_profits 194 | wX = [] 195 | vY = [] 196 | 197 | currentWager = 1 198 | previousWager = 'win' 199 | previousWagerAmount = initial_wager 200 | 201 | while currentWager <= wager_count: 202 | if previousWager == 'win': 203 | #print 'we won the last wager, great' 204 | if rollDice(): 205 | value+=wager 206 | #print value 207 | wX.append(currentWager) 208 | vY.append(value) 209 | else: 210 | value -= wager 211 | previousWager = 'loss' 212 | #print value 213 | previousWagerAmount = wager 214 | wX.append(currentWager) 215 | vY.append(value) 216 | if value <= 0: 217 | #print 'we went broke after'.currentWager,'bets' 218 | doubler_busts += 1 219 | break 220 | 221 | 222 | elif previousWager == 'loss': 223 | #print 'we lost the last one, so we will be smart and double' 224 | if rollDice(): 225 | wager = previousWagerAmount * 2 226 | 227 | if (value - wager) < 0: 228 | wager = value 229 | #print 'we won',wager 230 | value += wager 231 | #print value 232 | wager = initial_wager 233 | previousWager = 'win' 234 | wX.append(currentWager) 235 | vY.append(value) 236 | else: 237 | wager = previousWagerAmount * 2 238 | if (value - wager) < 0: 239 | wager = value 240 | #print 'we lost',wager 241 | value -= wager 242 | previousWagerAmount = wager 243 | wX.append(currentWager) 244 | vY.append(value) 245 | if value <= 0: 246 | #print 'we went broke after',currentWager,'bets' 247 | doubler_busts += 1 248 | break 249 | 250 | #print value 251 | previousWager = 'loss' 252 | 253 | 254 | 255 | 256 | currentWager += 1 257 | 258 | #print value 259 | plt.plot(wX,vY,color) 260 | if value > funds: 261 | doubler_profits += 1 262 | 263 | 264 | def simple_bettor(funds, initial_wager, wager_count,color): 265 | global simple_busts 266 | global simple_profits 267 | value = funds 268 | wager = initial_wager 269 | 270 | wX = [] 271 | vY = [] 272 | 273 | currentWager = 1 274 | 275 | while currentWager <= wager_count: 276 | if rollDice(): 277 | value += wager 278 | wX.append(currentWager) 279 | vY.append(value) 280 | else: 281 | value -= wager 282 | wX.append(currentWager) 283 | vY.append(value) 284 | 285 | currentWager += 1 286 | 287 | if value <= 0: 288 | value = 0 289 | simple_busts+=1 290 | #print 'Funds:', value 291 | 292 | plt.plot(wX,vY,color) 293 | if value > funds: 294 | value = 0 295 | simple_profits+=1 296 | 297 | 298 | lower_bust = 31.235 299 | higher_profit = 63.208 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | sampleSize = 1000 310 | startingFunds = 10000 311 | 312 | 313 | 314 | while True: 315 | #wagerSize = 100 316 | #wagerCount = 100000 317 | wagerSize = random.uniform(1.0,1000.00) 318 | wagerCount = random.uniform(10.0,10000) 319 | 320 | Ret = 0.0 321 | da_profits = 0.0 322 | da_busts = 0.0 323 | daSampSize = 10000 324 | counter = 1 325 | 326 | while counter <= daSampSize: 327 | dAlembert(startingFunds,wagerSize,wagerCount) 328 | counter+=1 329 | 330 | ROI = Ret - (daSampSize*startingFunds) 331 | totalInvested = daSampSize*startingFunds 332 | percentROI = (ROI/totalInvested)*100.00 333 | 334 | if percentROI > 0.865: 335 | print '___________________________________________' 336 | print 'Total invested:',daSampSize*startingFunds 337 | print 'Total Return:', Ret 338 | print 'ROI',Ret - (daSampSize*startingFunds) 339 | print 'Percent ROI:',percentROI 340 | print 'Bust Rate:',(da_busts/daSampSize)*100.00 341 | print 'Profit rate:',(da_profits/daSampSize)*100.00 342 | print 'wager size:',wagerSize 343 | print 'wager count:',wagerCount 344 | print 'wager size percentage:', (wagerSize/startingFunds)*100.00 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | -------------------------------------------------------------------------------- /montecarlo1.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | 4 | def rollDice(): 5 | roll = random.randint(1,100) 6 | return roll 7 | 8 | # Now, just to test our dice, let's roll the dice 100 times. 9 | 10 | x = 0 11 | while x < 100: 12 | result = rollDice() 13 | print result 14 | x+=1 15 | -------------------------------------------------------------------------------- /montecarlo10.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | import matplotlib 4 | import matplotlib.pyplot as plt 5 | import time 6 | 7 | sampleSize = 10000 8 | startingFunds = 10000 9 | wagerSize = 100 10 | wagerCount = 100 11 | 12 | from matplotlib import style 13 | style.use("ggplot") 14 | 15 | 16 | 17 | 18 | def rollDice(): 19 | roll = random.randint(1,100) 20 | 21 | if roll == 100: 22 | return False 23 | elif roll <= 50: 24 | return False 25 | elif 100 > roll >= 50: 26 | return True 27 | 28 | def doubler_bettor(funds,initial_wager,wager_count,color): 29 | global doubler_busts 30 | ##################### 31 | global doubler_profits 32 | value = funds 33 | wager = initial_wager 34 | wX = [] 35 | vY = [] 36 | currentWager = 1 37 | previousWager = 'win' 38 | previousWagerAmount = initial_wager 39 | 40 | while currentWager <= wager_count: 41 | if previousWager == 'win': 42 | if rollDice(): 43 | value += wager 44 | wX.append(currentWager) 45 | vY.append(value) 46 | else: 47 | value -= wager 48 | previousWager = 'loss' 49 | previousWagerAmount = wager 50 | wX.append(currentWager) 51 | vY.append(value) 52 | if value < 0: 53 | currentWager += 10000000000000000 54 | doubler_busts += 1 55 | elif previousWager == 'loss': 56 | if rollDice(): 57 | wager = previousWagerAmount * 2 58 | if (value - wager) < 0: 59 | wager = value 60 | 61 | value += wager 62 | wager = initial_wager 63 | previousWager = 'win' 64 | wX.append(currentWager) 65 | vY.append(value) 66 | else: 67 | wager = previousWagerAmount * 2 68 | if (value - wager) < 0: 69 | wager = value 70 | value -= wager 71 | previousWager = 'loss' 72 | previousWagerAmount = wager 73 | wX.append(currentWager) 74 | vY.append(value) 75 | 76 | if value <= 0: 77 | currentWager += 10000000000000000 78 | doubler_busts += 1 79 | 80 | currentWager += 1 81 | plt.plot(wX,vY,color) 82 | ##################### 83 | if value > funds: 84 | doubler_profits+=1 85 | 86 | 87 | 88 | ''' 89 | Simple bettor, betting the same amount each time. 90 | ''' 91 | 92 | def simple_bettor(funds,initial_wager,wager_count,color): 93 | global simple_busts 94 | ##################### 95 | global simple_profits 96 | 97 | value = funds 98 | wager = initial_wager 99 | wX = [] 100 | vY = [] 101 | currentWager = 1 102 | while currentWager <= wager_count: 103 | if rollDice(): 104 | value += wager 105 | wX.append(currentWager) 106 | vY.append(value) 107 | else: 108 | value -= wager 109 | wX.append(currentWager) 110 | vY.append(value) 111 | 112 | if value <= 0: 113 | currentWager += 10000000000000000 114 | simple_busts +=1 115 | currentWager += 1 116 | plt.plot(wX,vY,color) 117 | ##################### 118 | if value > funds: 119 | simple_profits+=1 120 | 121 | 122 | x = 0 123 | 124 | 125 | 126 | simple_busts = 0.0 127 | doubler_busts = 0.0 128 | 129 | ##################### 130 | simple_profits = 0.0 131 | doubler_profits = 0.0 132 | 133 | 134 | while x < sampleSize: 135 | simple_bettor(startingFunds,wagerSize,wagerCount,'c') 136 | #simple_bettor(startingFunds,wagerSize*2,wagerCount,'c') 137 | doubler_bettor(startingFunds,wagerSize,wagerCount,'k') 138 | x+=1 139 | 140 | 141 | print(('Simple Bettor Bust Chances:', (simple_busts/sampleSize)*100.00)) 142 | print(('Doubler Bettor Bust Chances:', (doubler_busts/sampleSize)*100.00)) 143 | 144 | print (('Simple Bettor Profit Chances:', (simple_profits/sampleSize)*100.00)) 145 | print(('Doubler Bettor Profit Chances:', (doubler_profits/sampleSize)*100.00)) 146 | 147 | 148 | plt.axhline(0, color = 'r') 149 | plt.ylabel('Account Value') 150 | plt.xlabel('Wager Count') 151 | plt.show() 152 | 153 | 154 | -------------------------------------------------------------------------------- /montecarlo11.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | import matplotlib 4 | import matplotlib.pyplot as plt 5 | import time 6 | 7 | ## MUST BEAT these! 8 | ''' 9 | The question is, can we find a simple variable change where there is both 10 | lower risk, and higher profit... and soon, is this the case accross an average 11 | of 1 million samples. 12 | 13 | ''' 14 | lower_bust = 31.235 15 | higher_profit = 63.208 16 | 17 | # back to 1,000 18 | sampleSize = 1000 19 | startingFunds = 10000 20 | wagerSize = 100 21 | wagerCount = 100 22 | 23 | 24 | 25 | 26 | def rollDice(): 27 | roll = random.randint(1,100) 28 | 29 | if roll == 100: 30 | return False 31 | elif roll <= 50: 32 | return False 33 | elif 100 > roll >= 50: 34 | return True 35 | 36 | 37 | 38 | def multiple_bettor(funds,initial_wager,wager_count):#,color): 39 | 40 | #add 41 | global multiple_busts 42 | global multiple_profits 43 | 44 | value = funds 45 | wager = initial_wager 46 | wX = [] 47 | vY = [] 48 | currentWager = 1 49 | previousWager = 'win' 50 | previousWagerAmount = initial_wager 51 | 52 | while currentWager <= wager_count: 53 | if previousWager == 'win': 54 | if rollDice(): 55 | value += wager 56 | wX.append(currentWager) 57 | vY.append(value) 58 | else: 59 | value -= wager 60 | previousWager = 'loss' 61 | previousWagerAmount = wager 62 | wX.append(currentWager) 63 | vY.append(value) 64 | if value <= 0: 65 | multiple_busts += 1 66 | break 67 | elif previousWager == 'loss': 68 | if rollDice(): 69 | 70 | #### must change the multiple #### 71 | wager = previousWagerAmount * random_multiple 72 | if (value - wager) <= 0: 73 | wager = value 74 | 75 | value += wager 76 | wager = initial_wager 77 | previousWager = 'win' 78 | wX.append(currentWager) 79 | vY.append(value) 80 | else: 81 | wager = previousWagerAmount * random_multiple 82 | if (value - wager) <= 0: 83 | wager = value 84 | value -= wager 85 | previousWager = 'loss' 86 | previousWagerAmount = wager 87 | wX.append(currentWager) 88 | vY.append(value) 89 | 90 | if value <= 0: 91 | #change 92 | multiple_busts += 1 93 | break 94 | 95 | currentWager += 1 96 | 97 | #plt.plot(wX,vY) 98 | ##################### 99 | if value > funds: 100 | #change 101 | multiple_profits+=1 102 | 103 | 104 | 105 | 106 | def doubler_bettor(funds,initial_wager,wager_count,color): 107 | global doubler_busts 108 | global doubler_profits 109 | value = funds 110 | wager = initial_wager 111 | wX = [] 112 | vY = [] 113 | currentWager = 1 114 | previousWager = 'win' 115 | previousWagerAmount = initial_wager 116 | 117 | while currentWager <= wager_count: 118 | if previousWager == 'win': 119 | if rollDice(): 120 | value += wager 121 | wX.append(currentWager) 122 | vY.append(value) 123 | else: 124 | value -= wager 125 | previousWager = 'loss' 126 | previousWagerAmount = wager 127 | wX.append(currentWager) 128 | vY.append(value) 129 | if value < 0: 130 | currentWager += 10000000000000000 131 | doubler_busts += 1 132 | elif previousWager == 'loss': 133 | if rollDice(): 134 | wager = previousWagerAmount * 2 135 | if (value - wager) < 0: 136 | wager = value 137 | 138 | value += wager 139 | wager = initial_wager 140 | previousWager = 'win' 141 | wX.append(currentWager) 142 | vY.append(value) 143 | else: 144 | wager = previousWagerAmount * 2 145 | if (value - wager) < 0: 146 | wager = value 147 | value -= wager 148 | previousWager = 'loss' 149 | previousWagerAmount = wager 150 | wX.append(currentWager) 151 | vY.append(value) 152 | 153 | if value <= 0: 154 | currentWager += 10000000000000000 155 | doubler_busts += 1 156 | 157 | currentWager += 1 158 | #plt.plot(wX,vY,color) 159 | ##################### 160 | if value > funds: 161 | doubler_profits+=1 162 | 163 | def simple_bettor(funds,initial_wager,wager_count,color): 164 | global simple_busts 165 | global simple_profits 166 | 167 | value = funds 168 | wager = initial_wager 169 | wX = [] 170 | vY = [] 171 | currentWager = 1 172 | while currentWager <= wager_count: 173 | if rollDice(): 174 | value += wager 175 | wX.append(currentWager) 176 | vY.append(value) 177 | else: 178 | value -= wager 179 | wX.append(currentWager) 180 | vY.append(value) 181 | 182 | if value <= 0: 183 | currentWager += 10000000000000000 184 | simple_busts +=1 185 | currentWager += 1 186 | plt.plot(wX,vY,color) 187 | if value > funds: 188 | simple_profits+=1 189 | x = 0 190 | 191 | #Doubler Bettor Bust Chances: 84.1457... so anything less than this... aaaand 192 | #Doubler Bettor Profit Chances: 15.6355 ... aaaand better than this. 193 | 194 | while x < 10: 195 | print(x) 196 | 197 | ######## move this stuff in here for the maths. 198 | multiple_busts = 0.0 199 | multiple_profits = 0.0 200 | # now we're wanting to do 100 attempts to get a good sample # 201 | multipleSampSize = 100000 202 | currentSample = 1 203 | 204 | random_multiple = random.uniform(0.1,10.0) 205 | #random_multiple = 2.00 206 | #print((random_multiple 207 | # adding this.... 208 | while currentSample <= multipleSampSize: 209 | multiple_bettor(startingFunds,wagerSize,wagerCount) 210 | #add one to sample 211 | currentSample += 1 212 | 213 | if ((multiple_busts/multipleSampSize)*100.00 < lower_bust) and ((multiple_profits/multipleSampSize)*100.00 > higher_profit): 214 | print(('#################################################')) 215 | print(('found a winner, the multiple was:',random_multiple)) 216 | print(('Lower Bust Rate Than:',lower_bust)) 217 | print(('Higher profit rate than:',higher_profit)) 218 | print(('Bust Rate:',(multiple_busts/multipleSampSize)*100.00)) 219 | print(('Profit Rate:',(multiple_profits/multipleSampSize)*100.00)) 220 | print(('#################################################')) 221 | #time.sleep(5) 222 | #plt.show() 223 | else: 224 | pass 225 | 226 | 227 | ## print(('####################################')) 228 | ## print(('To beat:')) 229 | ## print(('Lower Bust Rate Than:',lower_bust)) 230 | ## print(('Higher profit rate than:',higher_profit)) 231 | ## print(('Bust Rate:',(multiple_busts/multipleSampSize)*100.00)) 232 | ## print(('Profit Rate:',(multiple_profits/multipleSampSize)*100.00)) 233 | ## print(('####################################')) 234 | ## 235 | ## #clears the figure 236 | ## plt.clf() 237 | 238 | 239 | x+=1 240 | 241 | -------------------------------------------------------------------------------- /montecarlo11old.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import random 4 | import matplotlib 5 | import matplotlib.pyplot as plt 6 | import time 7 | 8 | ## MUST BEAT these! 9 | ''' 10 | The question is, can we find a simple variable change where there is both 11 | lower risk, and higher profit... and soon, is this the case accross an average 12 | of 1 million samples. 13 | 14 | ''' 15 | lower_bust = 84.1457 16 | higher_profit = 15.6355 17 | 18 | # back to 1,000 19 | sampleSize = 1000 20 | 21 | startingFunds = 1000 22 | wagerSize = 100 23 | wagerCount = 100 24 | 25 | 26 | 27 | 28 | def rollDice(): 29 | roll = random.randint(1,100) 30 | 31 | if roll == 100: 32 | return False 33 | elif roll <= 50: 34 | return False 35 | elif 100 > roll >= 50: 36 | return True 37 | 38 | 39 | 40 | def multiple_bettor(funds,initial_wager,wager_count):#,color): 41 | 42 | #add 43 | global multiple_busts 44 | global multiple_profits 45 | 46 | value = funds 47 | wager = initial_wager 48 | wX = [] 49 | vY = [] 50 | currentWager = 1 51 | previousWager = 'win' 52 | previousWagerAmount = initial_wager 53 | 54 | while currentWager <= wager_count: 55 | if previousWager == 'win': 56 | if rollDice(): 57 | value += wager 58 | wX.append(currentWager) 59 | vY.append(value) 60 | else: 61 | value -= wager 62 | previousWager = 'loss' 63 | previousWagerAmount = wager 64 | wX.append(currentWager) 65 | vY.append(value) 66 | if value < 0: 67 | currentWager += 10000000000000000 68 | multiple_busts += 1 69 | elif previousWager == 'loss': 70 | if rollDice(): 71 | 72 | #### must change the multiple #### 73 | wager = previousWagerAmount * random_multiple 74 | if (value - wager) < 0: 75 | wager = value 76 | 77 | value += wager 78 | wager = initial_wager 79 | previousWager = 'win' 80 | wX.append(currentWager) 81 | vY.append(value) 82 | else: 83 | ### must fix this.... esp if we already recorded 84 | wager = previousWagerAmount * random_multiple 85 | if (value - wager) < 0: 86 | wager = value 87 | value -= wager 88 | previousWager = 'loss' 89 | previousWagerAmount = wager 90 | wX.append(currentWager) 91 | vY.append(value) 92 | 93 | if value <= 0: 94 | currentWager += 10000000000000000 95 | #change 96 | multiple_busts += 1 97 | 98 | currentWager += 1 99 | plt.plot(wX,vY) 100 | ##################### 101 | if value > funds: 102 | #change 103 | multiple_profits+=1 104 | 105 | 106 | 107 | 108 | def doubler_bettor(funds,initial_wager,wager_count,color): 109 | global doubler_busts 110 | global doubler_profits 111 | value = funds 112 | wager = initial_wager 113 | wX = [] 114 | vY = [] 115 | currentWager = 1 116 | previousWager = 'win' 117 | previousWagerAmount = initial_wager 118 | 119 | while currentWager <= wager_count: 120 | if previousWager == 'win': 121 | if rollDice(): 122 | value += wager 123 | wX.append(currentWager) 124 | vY.append(value) 125 | else: 126 | value -= wager 127 | previousWager = 'loss' 128 | previousWagerAmount = wager 129 | wX.append(currentWager) 130 | vY.append(value) 131 | if value < 0: 132 | currentWager += 10000000000000000 133 | doubler_busts += 1 134 | elif previousWager == 'loss': 135 | if rollDice(): 136 | wager = previousWagerAmount * 2 137 | if (value - wager) < 0: 138 | wager = value 139 | 140 | value += wager 141 | wager = initial_wager 142 | previousWager = 'win' 143 | wX.append(currentWager) 144 | vY.append(value) 145 | else: 146 | wager = previousWagerAmount * 2 147 | if (value - wager) < 0: 148 | wager = value 149 | value -= wager 150 | previousWager = 'loss' 151 | previousWagerAmount = wager 152 | wX.append(currentWager) 153 | vY.append(value) 154 | 155 | if value <= 0: 156 | currentWager += 10000000000000000 157 | doubler_busts += 1 158 | 159 | currentWager += 1 160 | #plt.plot(wX,vY,color) 161 | ##################### 162 | if value > funds: 163 | doubler_profits+=1 164 | 165 | def simple_bettor(funds,initial_wager,wager_count,color): 166 | global simple_busts 167 | global simple_profits 168 | 169 | value = funds 170 | wager = initial_wager 171 | wX = [] 172 | vY = [] 173 | currentWager = 1 174 | while currentWager <= wager_count: 175 | if rollDice(): 176 | value += wager 177 | wX.append(currentWager) 178 | vY.append(value) 179 | else: 180 | value -= wager 181 | wX.append(currentWager) 182 | vY.append(value) 183 | 184 | if value <= 0: 185 | currentWager += 10000000000000000 186 | simple_busts +=1 187 | currentWager += 1 188 | plt.plot(wX,vY,color) 189 | if value > funds: 190 | simple_profits+=1 191 | x = 0 192 | 193 | ######## delete the rest of the stuff, rename busts and profits 194 | multiple_busts = 0.0 195 | multiple_profits = 0.0 196 | 197 | while x < 10: 198 | random_multiple = random.uniform(0.1,10.0) 199 | print random_multiple 200 | multiple_bettor(startingFunds,wagerSize,wagerCount) 201 | x+=1 202 | 203 | plt.show() 204 | -------------------------------------------------------------------------------- /montecarlo13.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import random 4 | import matplotlib 5 | import matplotlib.pyplot as plt 6 | import time 7 | 8 | #lower_bust = 31.235 9 | #higher_profit = 63.208 10 | 11 | lower_bust = 19.00 12 | higher_profit = 69.00 13 | 14 | # back to 1,000 15 | sampleSize = 1000 16 | startingFunds = 10000 17 | wagerSize = 100 18 | wagerCount = 100 19 | 20 | 21 | 22 | 23 | def rollDice(): 24 | roll = random.randint(1,100) 25 | 26 | if roll == 100: 27 | return False 28 | elif roll <= 50: 29 | return False 30 | elif 100 > roll >= 50: 31 | return True 32 | 33 | 34 | 35 | def multiple_bettor(funds,initial_wager,wager_count):#,color): 36 | 37 | global multiple_busts 38 | global multiple_profits 39 | 40 | value = funds 41 | wager = initial_wager 42 | wX = [] 43 | vY = [] 44 | currentWager = 1 45 | previousWager = 'win' 46 | previousWagerAmount = initial_wager 47 | 48 | while currentWager <= wager_count: 49 | if previousWager == 'win': 50 | if rollDice(): 51 | value += wager 52 | wX.append(currentWager) 53 | vY.append(value) 54 | else: 55 | value -= wager 56 | previousWager = 'loss' 57 | previousWagerAmount = wager 58 | wX.append(currentWager) 59 | vY.append(value) 60 | if value <= 0: 61 | multiple_busts += 1 62 | break 63 | elif previousWager == 'loss': 64 | if rollDice(): 65 | wager = previousWagerAmount * random_multiple 66 | if (value - wager) <= 0: 67 | wager = value 68 | 69 | value += wager 70 | wager = initial_wager 71 | previousWager = 'win' 72 | wX.append(currentWager) 73 | vY.append(value) 74 | else: 75 | wager = previousWagerAmount * random_multiple 76 | if (value - wager) <= 0: 77 | wager = value 78 | value -= wager 79 | previousWager = 'loss' 80 | previousWagerAmount = wager 81 | wX.append(currentWager) 82 | vY.append(value) 83 | 84 | if value <= 0: 85 | multiple_busts += 1 86 | break 87 | 88 | currentWager += 1 89 | 90 | #plt.plot(wX,vY) 91 | 92 | if value > funds: 93 | multiple_profits+=1 94 | 95 | 96 | 97 | def multiple_bettor2(funds,initial_wager,wager_count,multiple):#,color): 98 | 99 | global multiple_busts 100 | global multiple_profits 101 | 102 | value = funds 103 | wager = initial_wager 104 | wX = [] 105 | vY = [] 106 | currentWager = 1 107 | previousWager = 'win' 108 | previousWagerAmount = initial_wager 109 | 110 | while currentWager <= wager_count: 111 | if previousWager == 'win': 112 | if rollDice(): 113 | value += wager 114 | wX.append(currentWager) 115 | vY.append(value) 116 | else: 117 | value -= wager 118 | previousWager = 'loss' 119 | previousWagerAmount = wager 120 | wX.append(currentWager) 121 | vY.append(value) 122 | if value <= 0: 123 | multiple_busts += 1 124 | break 125 | elif previousWager == 'loss': 126 | if rollDice(): 127 | wager = previousWagerAmount * random_multiple 128 | if (value - wager) <= 0: 129 | wager = value 130 | 131 | value += wager 132 | wager = initial_wager 133 | previousWager = 'win' 134 | wX.append(currentWager) 135 | vY.append(value) 136 | else: 137 | wager = previousWagerAmount * 2 138 | if (value - wager) <= 0: 139 | wager = value 140 | value -= wager 141 | previousWager = 'loss' 142 | previousWagerAmount = wager 143 | wX.append(currentWager) 144 | vY.append(value) 145 | 146 | if value <= 0: 147 | multiple_busts += 1 148 | break 149 | 150 | currentWager += 1 151 | 152 | #plt.plot(wX,vY) 153 | 154 | if value > funds: 155 | multiple_profits+=1 156 | 157 | 158 | 159 | def doubler_bettor(funds,initial_wager,wager_count,color): 160 | global doubler_busts 161 | global doubler_profits 162 | value = funds 163 | wager = initial_wager 164 | wX = [] 165 | vY = [] 166 | currentWager = 1 167 | previousWager = 'win' 168 | previousWagerAmount = initial_wager 169 | 170 | while currentWager <= wager_count: 171 | if previousWager == 'win': 172 | if rollDice(): 173 | value += wager 174 | wX.append(currentWager) 175 | vY.append(value) 176 | else: 177 | value -= wager 178 | previousWager = 'loss' 179 | previousWagerAmount = wager 180 | wX.append(currentWager) 181 | vY.append(value) 182 | if value < 0: 183 | currentWager += 10000000000000000 184 | doubler_busts += 1 185 | elif previousWager == 'loss': 186 | if rollDice(): 187 | wager = previousWagerAmount * 2 188 | if (value - wager) < 0: 189 | wager = value 190 | 191 | value += wager 192 | wager = initial_wager 193 | previousWager = 'win' 194 | wX.append(currentWager) 195 | vY.append(value) 196 | else: 197 | wager = previousWagerAmount * 2 198 | if (value - wager) < 0: 199 | wager = value 200 | value -= wager 201 | previousWager = 'loss' 202 | previousWagerAmount = wager 203 | wX.append(currentWager) 204 | vY.append(value) 205 | 206 | if value <= 0: 207 | currentWager += 10000000000000000 208 | doubler_busts += 1 209 | 210 | currentWager += 1 211 | #plt.plot(wX,vY,color) 212 | if value > funds: 213 | doubler_profits+=1 214 | 215 | def simple_bettor(funds,initial_wager,wager_count,color): 216 | global simple_busts 217 | global simple_profits 218 | 219 | value = funds 220 | wager = initial_wager 221 | wX = [] 222 | vY = [] 223 | currentWager = 1 224 | while currentWager <= wager_count: 225 | if rollDice(): 226 | value += wager 227 | wX.append(currentWager) 228 | vY.append(value) 229 | else: 230 | value -= wager 231 | wX.append(currentWager) 232 | vY.append(value) 233 | 234 | if value <= 0: 235 | currentWager += 10000000000000000 236 | simple_busts +=1 237 | currentWager += 1 238 | plt.plot(wX,vY,color) 239 | if value > funds: 240 | simple_profits+=1 241 | x = 0 242 | 243 | #Doubler Bettor Bust Chances: 84.1457... so anything less than this... aaaand 244 | #Doubler Bettor Profit Chances: 15.6355 ... aaaand better than this. 245 | 246 | while x < 10000: 247 | 248 | multiple_busts = 0.0 249 | multiple_profits = 0.0 250 | multipleSampSize = 100000 251 | currentSample = 1 252 | 253 | random_multiple = random.uniform(0.6,2.0) 254 | while currentSample <= multipleSampSize: 255 | multiple_bettor(startingFunds,wagerSize,wagerCount) 256 | currentSample += 1 257 | 258 | if ((multiple_busts/multipleSampSize)*100.00 < lower_bust) and ((multiple_profits/multipleSampSize)*100.00 > higher_profit): 259 | print(('#################################################')) 260 | print(('found a winner, the multiple was:',random_multiple)) 261 | print(('Lower Bust Rate Than:',lower_bust)) 262 | print(('Higher profit rate than:',higher_profit)) 263 | print(('Bust Rate:',(multiple_busts/multipleSampSize)*100.00)) 264 | print(('Profit Rate:',(multiple_profits/multipleSampSize)*100.00)) 265 | print(('#################################################')) 266 | time.sleep(5) 267 | #plt.show() 268 | else: 269 | ''' 270 | print '####################################' 271 | print 'To beat:' 272 | print 'Lower Bust Rate Than:',lower_bust 273 | print 'Higher profit rate than:',higher_profit 274 | print 'Bust Rate:',(multiple_busts/multipleSampSize)*100.00 275 | print 'Profit Rate:',(multiple_profits/multipleSampSize)*100.00 276 | print '####################################' 277 | ''' 278 | #clears the figure 279 | #plt.clf() 280 | 281 | 282 | x+=1 283 | 284 | -------------------------------------------------------------------------------- /montecarlo14 d'alembert.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | import matplotlib 4 | import matplotlib.pyplot as plt 5 | import time 6 | 7 | #lower_bust = 31.235 8 | #higher_profit = 63.208 9 | 10 | lower_bust = 19.00 11 | higher_profit = 69.00 12 | 13 | # back to 1,000 14 | sampleSize = 1000 15 | startingFunds = 10000 16 | wagerSize = 100 17 | wagerCount = 100 18 | 19 | 20 | 21 | 22 | def rollDice(): 23 | roll = random.randint(1,100) 24 | 25 | if roll == 100: 26 | return False 27 | elif roll <= 50: 28 | return False 29 | elif 100 > roll >= 50: 30 | return True 31 | 32 | 33 | 34 | 35 | def dAlembert(funds,initial_wager,wager_count):#,color): 36 | 37 | global da_busts 38 | global da_profits 39 | 40 | value = funds 41 | wager = initial_wager 42 | wX = [] 43 | vY = [] 44 | currentWager = 1 45 | previousWager = 'win' 46 | previousWagerAmount = initial_wager 47 | 48 | while currentWager <= wager_count: 49 | if previousWager == 'win': 50 | if wager == initial_wager: 51 | pass 52 | else: 53 | wager -= initial_wager 54 | 55 | #print 'current wager:',wager,'value:',value 56 | 57 | 58 | if rollDice(): 59 | value += wager 60 | #print 'we won! Current Value:',value 61 | wX.append(currentWager) 62 | vY.append(value) 63 | else: 64 | value -= wager 65 | previousWager = 'loss' 66 | #print 'we lost, current value',value 67 | previousWagerAmount = wager 68 | wX.append(currentWager) 69 | vY.append(value) 70 | if value <= 0: 71 | da_busts += 1 72 | break 73 | elif previousWager == 'loss': 74 | wager = previousWagerAmount + initial_wager 75 | if (value - wager) <= 0: 76 | wager = value 77 | #print 'Lost the last wager, current wager:',wager,'value:',value 78 | 79 | if rollDice(): 80 | value += wager 81 | #print 'we won! Current Value:',value 82 | previousWager = 'win' 83 | wX.append(currentWager) 84 | vY.append(value) 85 | else: 86 | value -= wager 87 | previousWager = 'loss' 88 | #print 'we lost, current value',value 89 | previousWagerAmount = wager 90 | wX.append(currentWager) 91 | vY.append(value) 92 | 93 | if value <= 0: 94 | da_busts += 1 95 | break 96 | 97 | currentWager += 1 98 | 99 | #plt.plot(wX,vY) 100 | 101 | if value > funds: 102 | da_profits+=1 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | def multiple_bettor(funds,initial_wager,wager_count):#,color): 112 | 113 | global multiple_busts 114 | global multiple_profits 115 | 116 | value = funds 117 | wager = initial_wager 118 | wX = [] 119 | vY = [] 120 | currentWager = 1 121 | previousWager = 'win' 122 | previousWagerAmount = initial_wager 123 | 124 | while currentWager <= wager_count: 125 | if previousWager == 'win': 126 | if rollDice(): 127 | value += wager 128 | wX.append(currentWager) 129 | vY.append(value) 130 | else: 131 | value -= wager 132 | previousWager = 'loss' 133 | previousWagerAmount = wager 134 | wX.append(currentWager) 135 | vY.append(value) 136 | if value <= 0: 137 | multiple_busts += 1 138 | break 139 | elif previousWager == 'loss': 140 | if rollDice(): 141 | wager = previousWagerAmount * random_multiple 142 | if (value - wager) <= 0: 143 | wager = value 144 | 145 | value += wager 146 | wager = initial_wager 147 | previousWager = 'win' 148 | wX.append(currentWager) 149 | vY.append(value) 150 | else: 151 | wager = previousWagerAmount * random_multiple 152 | if (value - wager) <= 0: 153 | wager = value 154 | value -= wager 155 | previousWager = 'loss' 156 | previousWagerAmount = wager 157 | wX.append(currentWager) 158 | vY.append(value) 159 | 160 | if value <= 0: 161 | multiple_busts += 1 162 | break 163 | 164 | currentWager += 1 165 | 166 | #plt.plot(wX,vY) 167 | 168 | if value > funds: 169 | multiple_profits+=1 170 | 171 | 172 | 173 | def multiple_bettor2(funds,initial_wager,wager_count,multiple):#,color): 174 | 175 | global multiple_busts 176 | global multiple_profits 177 | 178 | value = funds 179 | wager = initial_wager 180 | wX = [] 181 | vY = [] 182 | currentWager = 1 183 | previousWager = 'win' 184 | previousWagerAmount = initial_wager 185 | 186 | while currentWager <= wager_count: 187 | if previousWager == 'win': 188 | if rollDice(): 189 | value += wager 190 | wX.append(currentWager) 191 | vY.append(value) 192 | else: 193 | value -= wager 194 | previousWager = 'loss' 195 | previousWagerAmount = wager 196 | wX.append(currentWager) 197 | vY.append(value) 198 | if value <= 0: 199 | multiple_busts += 1 200 | break 201 | elif previousWager == 'loss': 202 | if rollDice(): 203 | wager = previousWagerAmount * random_multiple 204 | if (value - wager) <= 0: 205 | wager = value 206 | 207 | value += wager 208 | wager = initial_wager 209 | previousWager = 'win' 210 | wX.append(currentWager) 211 | vY.append(value) 212 | else: 213 | wager = previousWagerAmount * 2 214 | if (value - wager) <= 0: 215 | wager = value 216 | value -= wager 217 | previousWager = 'loss' 218 | previousWagerAmount = wager 219 | wX.append(currentWager) 220 | vY.append(value) 221 | 222 | if value <= 0: 223 | multiple_busts += 1 224 | break 225 | 226 | currentWager += 1 227 | 228 | #plt.plot(wX,vY) 229 | 230 | if value > funds: 231 | multiple_profits+=1 232 | 233 | 234 | 235 | def doubler_bettor(funds,initial_wager,wager_count,color): 236 | global doubler_busts 237 | global doubler_profits 238 | value = funds 239 | wager = initial_wager 240 | wX = [] 241 | vY = [] 242 | currentWager = 1 243 | previousWager = 'win' 244 | previousWagerAmount = initial_wager 245 | 246 | while currentWager <= wager_count: 247 | if previousWager == 'win': 248 | if rollDice(): 249 | value += wager 250 | wX.append(currentWager) 251 | vY.append(value) 252 | else: 253 | value -= wager 254 | previousWager = 'loss' 255 | previousWagerAmount = wager 256 | wX.append(currentWager) 257 | vY.append(value) 258 | if value < 0: 259 | currentWager += 10000000000000000 260 | doubler_busts += 1 261 | elif previousWager == 'loss': 262 | if rollDice(): 263 | wager = previousWagerAmount * 2 264 | if (value - wager) < 0: 265 | wager = value 266 | 267 | value += wager 268 | wager = initial_wager 269 | previousWager = 'win' 270 | wX.append(currentWager) 271 | vY.append(value) 272 | else: 273 | wager = previousWagerAmount * 2 274 | if (value - wager) < 0: 275 | wager = value 276 | value -= wager 277 | previousWager = 'loss' 278 | previousWagerAmount = wager 279 | wX.append(currentWager) 280 | vY.append(value) 281 | 282 | if value <= 0: 283 | currentWager += 10000000000000000 284 | doubler_busts += 1 285 | 286 | currentWager += 1 287 | #plt.plot(wX,vY,color) 288 | if value > funds: 289 | doubler_profits+=1 290 | 291 | def simple_bettor(funds,initial_wager,wager_count,color): 292 | global simple_busts 293 | global simple_profits 294 | 295 | value = funds 296 | wager = initial_wager 297 | wX = [] 298 | vY = [] 299 | currentWager = 1 300 | while currentWager <= wager_count: 301 | if rollDice(): 302 | value += wager 303 | wX.append(currentWager) 304 | vY.append(value) 305 | else: 306 | value -= wager 307 | wX.append(currentWager) 308 | vY.append(value) 309 | 310 | if value <= 0: 311 | currentWager += 10000000000000000 312 | simple_busts +=1 313 | currentWager += 1 314 | plt.plot(wX,vY,color) 315 | if value > funds: 316 | simple_profits+=1 317 | x = 0 318 | 319 | #Doubler Bettor Bust Chances: 84.1457... so anything less than this... aaaand 320 | #Doubler Bettor Profit Chances: 15.6355 ... aaaand better than this. 321 | 322 | while x < 1: 323 | 324 | da_busts = 0.0 325 | da_profits = 0.0 326 | daSampSize = 10000 327 | currentSample = 1 328 | 329 | #random_multiple = random.uniform(0.6,2.0) 330 | while currentSample <= daSampSize: 331 | dAlembert(startingFunds,wagerSize,wagerCount) 332 | currentSample += 1 333 | 334 | if ((da_busts/daSampSize)*100.00 < lower_bust) and ((da_profits/daSampSize)*100.00 > higher_profit): 335 | print '#################################################' 336 | #print 'found a winner, the multiple was:',random_multiple 337 | print 'Lower Bust Rate Than:',lower_bust 338 | print 'Higher profit rate than:',higher_profit 339 | print 'Bust Rate:',(da_busts/daSampSize)*100.00 340 | print 'Profit Rate:',(da_profits/daSampSize)*100.00 341 | print '#################################################' 342 | time.sleep(5) 343 | #plt.show() 344 | else: 345 | ''' 346 | print '####################################' 347 | print 'To beat:' 348 | print 'Lower Bust Rate Than:',lower_bust 349 | print 'Higher profit rate than:',higher_profit 350 | print 'Bust Rate:',(da_busts/daSampSize)*100.00 351 | print 'Profit Rate:',(da_profits/daSampSize)*100.00 352 | print '####################################' 353 | ''' 354 | #clears the figure 355 | #plt.clf() 356 | 357 | 358 | x+=1 359 | 360 | -------------------------------------------------------------------------------- /montecarlo15 - testing multiple 50 50.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | import matplotlib 4 | import matplotlib.pyplot as plt 5 | import time 6 | 7 | #lower_bust = 19.00 8 | #higher_profit = 69.00 9 | 10 | # back to 1,000 11 | sampleSize = 1000 12 | startingFunds = 100000 13 | wagerSize = 100 14 | wagerCount = 100 15 | 16 | 17 | 18 | ''' 19 | def rollDice(): 20 | roll = random.randint(1,100) 21 | 22 | if roll == 100: 23 | return False 24 | elif roll <= 50: 25 | return False 26 | elif 100 > roll >= 50: 27 | return True 28 | ''' 29 | 30 | 31 | def rollDice(): 32 | roll = random.randint(1,100) 33 | 34 | if roll <= 50: 35 | return False 36 | elif roll >= 51: 37 | return True 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | def multiple_bettor2(funds,initial_wager,wager_count,multiple):#,color): 49 | global ROI 50 | global multiple_busts 51 | global multiple_profits 52 | 53 | value = funds 54 | wager = initial_wager 55 | wX = [] 56 | vY = [] 57 | currentWager = 1 58 | previousWager = 'win' 59 | previousWagerAmount = initial_wager 60 | 61 | while currentWager <= wager_count: 62 | if previousWager == 'win': 63 | if rollDice(): 64 | value += wager 65 | wX.append(currentWager) 66 | vY.append(value) 67 | else: 68 | value -= wager 69 | previousWager = 'loss' 70 | previousWagerAmount = wager 71 | wX.append(currentWager) 72 | vY.append(value) 73 | if value <= 0: 74 | multiple_busts += 1 75 | break 76 | elif previousWager == 'loss': 77 | if rollDice(): 78 | wager = previousWagerAmount * multiple 79 | if (value - wager) <= 0: 80 | wager = value 81 | 82 | value += wager 83 | wager = initial_wager 84 | previousWager = 'win' 85 | wX.append(currentWager) 86 | vY.append(value) 87 | else: 88 | wager = previousWagerAmount * multiple 89 | if (value - wager) <= 0: 90 | wager = value 91 | value -= wager 92 | previousWager = 'loss' 93 | previousWagerAmount = wager 94 | wX.append(currentWager) 95 | vY.append(value) 96 | 97 | if value <= 0: 98 | multiple_busts += 1 99 | break 100 | 101 | 102 | currentWager += 1 103 | #print(('ending Value:',value 104 | ROI += value 105 | 106 | #plt.plot(wX,vY) 107 | 108 | if value > funds: 109 | multiple_profits+=1 110 | 111 | 112 | multipleSampSize = 1000000 113 | multiple_busts = 0.0 114 | multiple_profits = 0.0 115 | ROI = 0 116 | 117 | counter = 1 118 | while counter <= multipleSampSize: 119 | multiple_bettor2(startingFunds,wagerSize,wagerCount,1.75) 120 | counter += 1 121 | 122 | print(('Total Amount Invested:', multipleSampSize * startingFunds)) 123 | print(('Total Return:',ROI)) 124 | print(('Difference:',ROI-(multipleSampSize * startingFunds))) 125 | print(('Bust Rate:',(multiple_busts/multipleSampSize)*100.00)) 126 | print(('Profit Rate:',(multiple_profits/multipleSampSize)*100.00)) 127 | -------------------------------------------------------------------------------- /montecarlo16.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | import matplotlib 4 | import matplotlib.pyplot as plt 5 | import time 6 | 7 | #lower_bust = 19.00 8 | #higher_profit = 69.00 9 | 10 | # back to 1,000 11 | sampleSize = 10000 12 | startingFunds = 100000 13 | wagerSize = 100 14 | wagerCount = 1000 15 | 16 | 17 | def rollDice(): 18 | roll = random.randint(1,100) 19 | 20 | if roll <= 50: 21 | return False 22 | elif roll >= 51: 23 | return True 24 | 25 | 26 | 27 | 28 | def dAlembert(funds,initial_wager,wager_count):#,color): 29 | global ROI 30 | global da_busts 31 | global da_profits 32 | 33 | value = funds 34 | wager = initial_wager 35 | wX = [] 36 | vY = [] 37 | currentWager = 1 38 | previousWager = 'win' 39 | previousWagerAmount = initial_wager 40 | 41 | while currentWager <= wager_count: 42 | if previousWager == 'win': 43 | if wager == initial_wager: 44 | pass 45 | else: 46 | wager -= initial_wager 47 | 48 | #print 'current wager:',wager,'value:',value 49 | 50 | 51 | if rollDice(): 52 | value += wager 53 | #print 'we won! Current Value:',value 54 | wX.append(currentWager) 55 | vY.append(value) 56 | else: 57 | value -= wager 58 | previousWager = 'loss' 59 | #print 'we lost, current value',value 60 | previousWagerAmount = wager 61 | wX.append(currentWager) 62 | vY.append(value) 63 | if value <= 0: 64 | da_busts += 1 65 | break 66 | elif previousWager == 'loss': 67 | wager = previousWagerAmount + initial_wager 68 | if (value - wager) <= 0: 69 | wager = value 70 | #print 'Lost the last wager, current wager:',wager,'value:',value 71 | 72 | if rollDice(): 73 | value += wager 74 | #print 'we won! Current Value:',value 75 | previousWager = 'win' 76 | wX.append(currentWager) 77 | vY.append(value) 78 | else: 79 | value -= wager 80 | previousWager = 'loss' 81 | #print 'we lost, current value',value 82 | previousWagerAmount = wager 83 | wX.append(currentWager) 84 | vY.append(value) 85 | 86 | if value <= 0: 87 | da_busts += 1 88 | break 89 | 90 | currentWager += 1 91 | 92 | #plt.plot(wX,vY) 93 | 94 | if value > funds: 95 | da_profits+=1 96 | 97 | ROI += value 98 | 99 | 100 | 101 | 102 | 103 | 104 | def multiple_bettor2(funds,initial_wager,wager_count,multiple):#,color): 105 | global ROI 106 | global multiple_busts 107 | global multiple_profits 108 | 109 | value = funds 110 | wager = initial_wager 111 | wX = [] 112 | vY = [] 113 | currentWager = 1 114 | previousWager = 'win' 115 | previousWagerAmount = initial_wager 116 | 117 | while currentWager <= wager_count: 118 | if previousWager == 'win': 119 | if rollDice(): 120 | value += wager 121 | wX.append(currentWager) 122 | vY.append(value) 123 | else: 124 | value -= wager 125 | previousWager = 'loss' 126 | previousWagerAmount = wager 127 | wX.append(currentWager) 128 | vY.append(value) 129 | if value <= 0: 130 | multiple_busts += 1 131 | break 132 | elif previousWager == 'loss': 133 | if rollDice(): 134 | wager = previousWagerAmount * multiple 135 | if (value - wager) <= 0: 136 | wager = value 137 | 138 | value += wager 139 | wager = initial_wager 140 | previousWager = 'win' 141 | wX.append(currentWager) 142 | vY.append(value) 143 | else: 144 | wager = previousWagerAmount * multiple 145 | if (value - wager) <= 0: 146 | wager = value 147 | value -= wager 148 | previousWager = 'loss' 149 | previousWagerAmount = wager 150 | wX.append(currentWager) 151 | vY.append(value) 152 | 153 | if value <= 0: 154 | multiple_busts += 1 155 | break 156 | 157 | 158 | currentWager += 1 159 | #print 'ending Value:',value 160 | ROI += value 161 | 162 | #plt.plot(wX,vY) 163 | 164 | if value > funds: 165 | multiple_profits+=1 166 | 167 | 168 | daSampSize = 100000 169 | da_busts = 0.0 170 | da_profits = 0.0 171 | ROI = 0 172 | 173 | counter = 1 174 | while counter <= daSampSize: 175 | #multiple_bettor2(startingFunds,wagerSize,wagerCount,2) 176 | dAlembert(startingFunds,wagerSize,wagerCount) 177 | counter += 1 178 | 179 | print 'Total Amount Invested:', daSampSize * startingFunds 180 | print 'Total Return:',ROI 181 | print 'Difference:',ROI-(daSampSize * startingFunds) 182 | print 'Bust Rate:',(da_busts/daSampSize)*100.00 183 | print 'Profit Rate:',(da_profits/daSampSize)*100.00 184 | -------------------------------------------------------------------------------- /montecarlo17 50 50 odds multiple test.py: -------------------------------------------------------------------------------- 1 | import random 2 | import matplotlib 3 | import matplotlib.pyplot as plt 4 | import time 5 | 6 | ## MUST BEAT these! 7 | ''' 8 | The question is, can we find a simple variable change where there is both 9 | lower risk, and higher profit... and soon, is this the case accross an average 10 | of 1 million samples. 11 | 12 | ''' 13 | lower_bust = 31.235 14 | higher_profit = 63.208 15 | 16 | # back to 1,000 17 | sampleSize = 1000 18 | startingFunds = 10000 19 | wagerSize = 100 20 | wagerCount = 100 21 | 22 | 23 | 24 | ''' 25 | def rollDice(): 26 | roll = random.randint(1,100) 27 | 28 | if roll == 100: 29 | return False 30 | elif roll <= 50: 31 | return False 32 | elif 100 > roll >= 50: 33 | return True 34 | ''' 35 | 36 | 37 | def rollDice(): 38 | roll = random.randint(1,100) 39 | 40 | if roll <= 50: 41 | return False 42 | elif roll >= 51: 43 | return True 44 | 45 | 46 | 47 | 48 | def multiple_bettor(funds,initial_wager,wager_count):#,color): 49 | 50 | #add 51 | global multiple_busts 52 | global multiple_profits 53 | 54 | value = funds 55 | wager = initial_wager 56 | wX = [] 57 | vY = [] 58 | currentWager = 1 59 | previousWager = 'win' 60 | previousWagerAmount = initial_wager 61 | 62 | while currentWager <= wager_count: 63 | if previousWager == 'win': 64 | if rollDice(): 65 | value += wager 66 | wX.append(currentWager) 67 | vY.append(value) 68 | else: 69 | value -= wager 70 | previousWager = 'loss' 71 | previousWagerAmount = wager 72 | wX.append(currentWager) 73 | vY.append(value) 74 | if value <= 0: 75 | multiple_busts += 1 76 | break 77 | elif previousWager == 'loss': 78 | if rollDice(): 79 | 80 | #### must change the multiple #### 81 | wager = previousWagerAmount * random_multiple 82 | if (value - wager) <= 0: 83 | wager = value 84 | 85 | value += wager 86 | wager = initial_wager 87 | previousWager = 'win' 88 | wX.append(currentWager) 89 | vY.append(value) 90 | else: 91 | wager = previousWagerAmount * random_multiple 92 | if (value - wager) <= 0: 93 | wager = value 94 | value -= wager 95 | previousWager = 'loss' 96 | previousWagerAmount = wager 97 | wX.append(currentWager) 98 | vY.append(value) 99 | 100 | if value <= 0: 101 | #change 102 | multiple_busts += 1 103 | break 104 | 105 | currentWager += 1 106 | 107 | #plt.plot(wX,vY) 108 | ##################### 109 | if value > funds: 110 | #change 111 | multiple_profits+=1 112 | 113 | 114 | 115 | 116 | def doubler_bettor(funds,initial_wager,wager_count,color): 117 | global doubler_busts 118 | global doubler_profits 119 | value = funds 120 | wager = initial_wager 121 | wX = [] 122 | vY = [] 123 | currentWager = 1 124 | previousWager = 'win' 125 | previousWagerAmount = initial_wager 126 | 127 | while currentWager <= wager_count: 128 | if previousWager == 'win': 129 | if rollDice(): 130 | value += wager 131 | wX.append(currentWager) 132 | vY.append(value) 133 | else: 134 | value -= wager 135 | previousWager = 'loss' 136 | previousWagerAmount = wager 137 | wX.append(currentWager) 138 | vY.append(value) 139 | if value < 0: 140 | currentWager += 10000000000000000 141 | doubler_busts += 1 142 | elif previousWager == 'loss': 143 | if rollDice(): 144 | wager = previousWagerAmount * 2 145 | if (value - wager) < 0: 146 | wager = value 147 | 148 | value += wager 149 | wager = initial_wager 150 | previousWager = 'win' 151 | wX.append(currentWager) 152 | vY.append(value) 153 | else: 154 | wager = previousWagerAmount * 2 155 | if (value - wager) < 0: 156 | wager = value 157 | value -= wager 158 | previousWager = 'loss' 159 | previousWagerAmount = wager 160 | wX.append(currentWager) 161 | vY.append(value) 162 | 163 | if value <= 0: 164 | currentWager += 10000000000000000 165 | doubler_busts += 1 166 | 167 | currentWager += 1 168 | #plt.plot(wX,vY,color) 169 | ##################### 170 | if value > funds: 171 | doubler_profits+=1 172 | 173 | def simple_bettor(funds,initial_wager,wager_count,color): 174 | global simple_busts 175 | global simple_profits 176 | 177 | value = funds 178 | wager = initial_wager 179 | wX = [] 180 | vY = [] 181 | currentWager = 1 182 | while currentWager <= wager_count: 183 | if rollDice(): 184 | value += wager 185 | wX.append(currentWager) 186 | vY.append(value) 187 | else: 188 | value -= wager 189 | wX.append(currentWager) 190 | vY.append(value) 191 | 192 | if value <= 0: 193 | currentWager += 10000000000000000 194 | simple_busts +=1 195 | currentWager += 1 196 | plt.plot(wX,vY,color) 197 | if value > funds: 198 | simple_profits+=1 199 | x = 0 200 | 201 | #Doubler Bettor Bust Chances: 84.1457... so anything less than this... aaaand 202 | #Doubler Bettor Profit Chances: 15.6355 ... aaaand better than this. 203 | 204 | while x < 10000: 205 | 206 | ######## move this stuff in here for the maths. 207 | multiple_busts = 0.0 208 | multiple_profits = 0.0 209 | # now we're wanting to do 100 attempts to get a good sample # 210 | multipleSampSize = 100000 211 | currentSample = 1 212 | 213 | random_multiple = random.uniform(0.1,10.0) 214 | #random_multiple = 2.00 215 | #print random_multiple 216 | # adding this.... 217 | while currentSample <= multipleSampSize: 218 | multiple_bettor(startingFunds,wagerSize,wagerCount) 219 | #add one to sample 220 | currentSample += 1 221 | 222 | if ((multiple_busts/multipleSampSize)*100.00 < lower_bust) and ((multiple_profits/multipleSampSize)*100.00 > higher_profit): 223 | print '#################################################' 224 | print 'found a winner, the multiple was:',random_multiple 225 | print 'Lower Bust Rate Than:',lower_bust 226 | print 'Higher profit rate than:',higher_profit 227 | print 'Bust Rate:',(multiple_busts/multipleSampSize)*100.00 228 | print 'Profit Rate:',(multiple_profits/multipleSampSize)*100.00 229 | print '#################################################' 230 | time.sleep(5) 231 | #plt.show() 232 | else: 233 | ''' 234 | print '####################################' 235 | print 'To beat:' 236 | print 'Lower Bust Rate Than:',lower_bust 237 | print 'Higher profit rate than:',higher_profit 238 | print 'Bust Rate:',(multiple_busts/multipleSampSize)*100.00 239 | print 'Profit Rate:',(multiple_profits/multipleSampSize)*100.00 240 | print '####################################' 241 | ''' 242 | #clears the figure 243 | #plt.clf() 244 | 245 | 246 | x+=1 247 | 248 | -------------------------------------------------------------------------------- /montecarlo2.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import random 4 | 5 | 6 | # let us go ahead and change this to return a simple win/loss 7 | def rollDice(): 8 | roll = random.randint(1,100) 9 | 10 | if roll == 100: 11 | print roll,'roll was 100, you lose. What are the odds?! Play again!' 12 | return False 13 | elif roll <= 50: 14 | print roll,'roll was 1-50, you lose.' 15 | return False 16 | elif 100 > roll >= 50: 17 | print roll,'roll was 51-99, you win! *pretty lights flash* (play more!)' 18 | return True 19 | 20 | 21 | ''' 22 | Simple bettor, betting the same amount each time. 23 | ''' 24 | def simple_bettor(funds,initial_wager,wager_count): 25 | value = funds 26 | wager = initial_wager 27 | 28 | currentWager = 0 29 | 30 | while currentWager < wager_count: 31 | if rollDice(): 32 | value += wager 33 | else: 34 | value -= wager 35 | 36 | currentWager += 1 37 | print 'Funds:', value 38 | 39 | 40 | 41 | simple_bettor(10000,100,100) 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /montecarlo3.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import random 4 | 5 | 6 | # let us go ahead and change this to return a simple win/loss 7 | def rollDice(): 8 | roll = random.randint(1,100) 9 | 10 | if roll == 100: 11 | #print roll,'roll was 100, you lose. What are the odds?! Play again!' 12 | return False 13 | elif roll <= 50: 14 | #print roll,'roll was 1-50, you lose.' 15 | return False 16 | elif 100 > roll >= 50: 17 | #print roll,'roll was 51-99, you win! *pretty lights flash* (play more!)' 18 | return True 19 | 20 | 21 | ''' 22 | Simple bettor, betting the same amount each time. 23 | ''' 24 | def simple_bettor(funds,initial_wager,wager_count): 25 | value = funds 26 | wager = initial_wager 27 | 28 | currentWager = 0 29 | 30 | while currentWager < wager_count: 31 | if rollDice(): 32 | value += wager 33 | else: 34 | value -= wager 35 | 36 | currentWager += 1 37 | 38 | # changed to reduce spam 39 | if value < 0: 40 | value = 'Broke!' 41 | print 'Funds:', value 42 | 43 | # lots of wagers now.... 44 | x = 0 45 | 46 | while x < 100: 47 | simple_bettor(10000,100,50) 48 | x += 1 49 | 50 | -------------------------------------------------------------------------------- /montecarlo4.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | import matplotlib 4 | import matplotlib.pyplot as plt 5 | from matplotlib import style 6 | style.use("ggplot") 7 | 8 | def rollDice(): 9 | roll = random.randint(1,100) 10 | 11 | if roll == 100: 12 | return False 13 | elif roll <= 50: 14 | return False 15 | elif 100 > roll >= 50: 16 | return True 17 | 18 | 19 | ''' 20 | Simple bettor, betting the same amount each time. 21 | ''' 22 | def simple_bettor(funds,initial_wager,wager_count): 23 | value = funds 24 | wager = initial_wager 25 | 26 | # wager X 27 | wX = [] 28 | 29 | #value Y 30 | vY = [] 31 | 32 | # change to 1, to avoid confusion so we start @ wager 1 33 | # instead of wager 0 and end at 100. 34 | currentWager = 1 35 | 36 | # change this to, less or equal. 37 | while currentWager <= wager_count: 38 | if rollDice(): 39 | value += wager 40 | # append # 41 | wX.append(currentWager) 42 | vY.append(value) 43 | 44 | else: 45 | value -= wager 46 | # append # 47 | wX.append(currentWager) 48 | vY.append(value) 49 | 50 | currentWager += 1 51 | 52 | #print 'Funds:', value 53 | 54 | plt.plot(wX,vY) 55 | 56 | 57 | 58 | x = 0 59 | 60 | # start this off @ 1, then add, and increase 50 to 500, then 1000 61 | while x < 100: 62 | simple_bettor(10000,100,100) 63 | x += 1 64 | 65 | 66 | plt.ylabel('Account Value') 67 | plt.xlabel('Wager Count') 68 | plt.show() 69 | 70 | 71 | -------------------------------------------------------------------------------- /montecarlo5.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | import matplotlib 4 | import matplotlib.pyplot as plt 5 | # 6 | import time 7 | from matplotlib import style 8 | style.use("ggplot") 9 | 10 | def rollDice(): 11 | roll = random.randint(1,100) 12 | 13 | if roll == 100: 14 | return False 15 | elif roll <= 50: 16 | return False 17 | elif 100 > roll >= 50: 18 | return True 19 | 20 | 21 | def doubler_bettor(funds,initial_wager,wager_count): 22 | value = funds 23 | wager = initial_wager 24 | wX = [] 25 | vY = [] 26 | currentWager = 1 27 | 28 | # since we'll be betting based on previous bet outcome # 29 | previousWager = 'win' 30 | 31 | # since we'll be doubling # 32 | previousWagerAmount = initial_wager 33 | 34 | ''' 35 | immediately with these comments, and our previous discussion of how previous outcomes 36 | do not affect future outcome possibilities, you should realize that this betting method 37 | offers nothing more than a quicker realization of losses or gains. 38 | 39 | Another way to visualize this quicker realization is actually an increase in risk. 40 | This bettor will experience extremely unpredictable volatility most likely. 41 | ''' 42 | 43 | while currentWager <= wager_count: 44 | if previousWager == 'win': 45 | #print 'we won the last wager, yay!' 46 | if rollDice(): 47 | value += wager 48 | #print value 49 | wX.append(currentWager) 50 | vY.append(value) 51 | else: 52 | value -= wager 53 | previousWager = 'loss' 54 | #print value 55 | previousWagerAmount = wager 56 | wX.append(currentWager) 57 | vY.append(value) 58 | if value < 0: 59 | #print 'went broke after',currentWager,'bets' 60 | currentWager += 10000000000000000 61 | elif previousWager == 'loss': 62 | #print 'we lost the last one, so we will be super smart & double up!' 63 | if rollDice(): 64 | wager = previousWagerAmount * 2 65 | #print 'we won',wager 66 | value += wager 67 | #print value 68 | wager = initial_wager 69 | previousWager = 'win' 70 | wX.append(currentWager) 71 | vY.append(value) 72 | else: 73 | wager = previousWagerAmount * 2 74 | #print 'we lost',wager 75 | value -= wager 76 | if value < 0: 77 | #print 'went broke after',currentWager,'bets' 78 | currentWager += 10000000000000000 79 | #print value 80 | previousWager = 'loss' 81 | previousWagerAmount = wager 82 | wX.append(currentWager) 83 | vY.append(value) 84 | if value < 0: 85 | #print 'went broke after',currentWager,'bets' 86 | currentWager += 10000000000000000 87 | 88 | currentWager += 1 89 | 90 | #print value 91 | plt.plot(wX,vY) 92 | 93 | 94 | 95 | 96 | doubler_bettor(10000,100,100) 97 | plt.show() 98 | time.sleep(555) 99 | 100 | 101 | 102 | 103 | ''' 104 | Simple bettor, betting the same amount each time. 105 | ''' 106 | def simple_bettor(funds,initial_wager,wager_count): 107 | value = funds 108 | wager = initial_wager 109 | wX = [] 110 | vY = [] 111 | currentWager = 1 112 | while currentWager <= wager_count: 113 | if rollDice(): 114 | value += wager 115 | wX.append(currentWager) 116 | vY.append(value) 117 | else: 118 | value -= wager 119 | wX.append(currentWager) 120 | vY.append(value) 121 | currentWager += 1 122 | plt.plot(wX,vY) 123 | x = 0 124 | 125 | 126 | while x < 100: 127 | simple_bettor(10000,100,1000) 128 | x += 1 129 | 130 | plt.ylabel('Account Value') 131 | plt.xlabel('Wager Count') 132 | plt.show() 133 | 134 | 135 | -------------------------------------------------------------------------------- /montecarlo6.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | import matplotlib 4 | import matplotlib.pyplot as plt 5 | # 6 | import time 7 | from matplotlib import style 8 | style.use("ggplot") 9 | def rollDice(): 10 | roll = random.randint(1,100) 11 | 12 | if roll == 100: 13 | return False 14 | elif roll <= 50: 15 | return False 16 | elif 100 > roll >= 50: 17 | return True 18 | 19 | 20 | def doubler_bettor(funds,initial_wager,wager_count): 21 | global broke_count 22 | value = funds 23 | wager = initial_wager 24 | wX = [] 25 | vY = [] 26 | currentWager = 1 27 | 28 | # since we'll be betting based on previous bet outcome # 29 | previousWager = 'win' 30 | 31 | # since we'll be doubling # 32 | previousWagerAmount = initial_wager 33 | 34 | ''' 35 | immediately with these comments, and our previous discussion of how previous outcomes 36 | do not affect future outcome possibilities, you should realize that this betting method 37 | offers nothing more than a quicker realization of losses or gains. 38 | 39 | Another way to visualize this quicker realization is actually an increase in risk. 40 | This bettor will experience extremely unpredictable volatility most likely. 41 | ''' 42 | 43 | while currentWager <= wager_count: 44 | if previousWager == 'win': 45 | ##print 'we won the last wager, yay!' 46 | if rollDice(): 47 | value += wager 48 | ##print value 49 | wX.append(currentWager) 50 | vY.append(value) 51 | else: 52 | value -= wager 53 | previousWager = 'loss' 54 | ##print value 55 | previousWagerAmount = wager 56 | wX.append(currentWager) 57 | vY.append(value) 58 | if value < 0: 59 | ##print 'went broke after',currentWager,'bets' 60 | broke_count += 1 61 | currentWager += 10000000000000000 62 | elif previousWager == 'loss': 63 | ##print 'we lost the last one, so we will be super smart & double up!' 64 | if rollDice(): 65 | wager = previousWagerAmount * 2 66 | ##print 'we won',wager 67 | value += wager 68 | ##print value 69 | wager = initial_wager 70 | previousWager = 'win' 71 | wX.append(currentWager) 72 | vY.append(value) 73 | else: 74 | wager = previousWagerAmount * 2 75 | ##print 'we lost',wager 76 | value -= wager 77 | ##print value 78 | previousWager = 'loss' 79 | previousWagerAmount = wager 80 | wX.append(currentWager) 81 | vY.append(value) 82 | if value < 0: 83 | ##print 'went broke after',currentWager,'bets' 84 | currentWager += 10000000000000000 85 | broke_count += 1 86 | 87 | currentWager += 1 88 | 89 | ##print value 90 | plt.plot(wX,vY) 91 | 92 | 93 | 94 | xx = 0 95 | broke_count = 0 96 | 97 | while xx < 1000: 98 | doubler_bettor(10000,100,100) 99 | xx+=1 100 | 101 | #print 'death rate:',(broke_count/float(xx)) * 100 102 | #print 'survival rate:',100 - ((broke_count/float(xx)) * 100) 103 | plt.axhline(0, color = 'r') 104 | plt.show() 105 | time.sleep(555) 106 | 107 | 108 | 109 | 110 | ''' 111 | Simple bettor, betting the same amount each time. 112 | ''' 113 | def simple_bettor(funds,initial_wager,wager_count): 114 | value = funds 115 | wager = initial_wager 116 | wX = [] 117 | vY = [] 118 | currentWager = 1 119 | while currentWager <= wager_count: 120 | if rollDice(): 121 | value += wager 122 | wX.append(currentWager) 123 | vY.append(value) 124 | else: 125 | value -= wager 126 | wX.append(currentWager) 127 | vY.append(value) 128 | currentWager += 1 129 | plt.plot(wX,vY) 130 | x = 0 131 | 132 | 133 | while x < 100: 134 | simple_bettor(10000,100,1000) 135 | x += 1 136 | 137 | plt.ylabel('Account Value') 138 | plt.xlabel('Wager Count') 139 | plt.show() 140 | 141 | 142 | -------------------------------------------------------------------------------- /montecarlo7.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import random 4 | import matplotlib 5 | import matplotlib.pyplot as plt 6 | import time 7 | 8 | from matplotlib import style 9 | style.use("ggplot") 10 | 11 | def rollDice(): 12 | roll = random.randint(1,100) 13 | 14 | if roll == 100: 15 | return False 16 | elif roll <= 50: 17 | return False 18 | elif 100 > roll >= 50: 19 | return True 20 | 21 | 22 | def doubler_bettor(funds,initial_wager,wager_count): 23 | global broke_count 24 | value = funds 25 | wager = initial_wager 26 | wX = [] 27 | vY = [] 28 | currentWager = 1 29 | previousWager = 'win' 30 | previousWagerAmount = initial_wager 31 | 32 | while currentWager <= wager_count: 33 | if previousWager == 'win': 34 | if rollDice(): 35 | value += wager 36 | wX.append(currentWager) 37 | vY.append(value) 38 | else: 39 | value -= wager 40 | previousWager = 'loss' 41 | previousWagerAmount = wager 42 | wX.append(currentWager) 43 | vY.append(value) 44 | if value < 0: 45 | broke_count += 1 46 | currentWager += 10000000000000000 47 | elif previousWager == 'loss': 48 | if rollDice(): 49 | wager = previousWagerAmount * 2 50 | value += wager 51 | wager = initial_wager 52 | previousWager = 'win' 53 | wX.append(currentWager) 54 | vY.append(value) 55 | else: 56 | wager = previousWagerAmount * 2 57 | value -= wager 58 | previousWager = 'loss' 59 | previousWagerAmount = wager 60 | wX.append(currentWager) 61 | vY.append(value) 62 | if value < 0: 63 | currentWager += 10000000000000000 64 | broke_count += 1 65 | 66 | currentWager += 1 67 | 68 | plt.plot(wX,vY) 69 | 70 | 71 | def simple_bettor(funds,initial_wager,wager_count): 72 | #### 73 | global broke_count 74 | 75 | value = funds 76 | wager = initial_wager 77 | wX = [] 78 | vY = [] 79 | currentWager = 1 80 | while currentWager <= wager_count: 81 | if rollDice(): 82 | value += wager 83 | wX.append(currentWager) 84 | vY.append(value) 85 | else: 86 | value -= wager 87 | wX.append(currentWager) 88 | vY.append(value) 89 | 90 | ###add me 91 | if value < 0: 92 | currentWager += 10000000000000000 93 | broke_count += 1 94 | currentWager += 1 95 | plt.plot(wX,vY) 96 | 97 | 98 | x = 0 99 | broke_count = 0 100 | while x < 1000: 101 | simple_bettor(10000,100,1000) 102 | x+=1 103 | print(('death rate:',(broke_count/float(x)) * 100)) 104 | print(('survival rate:',100 - ((broke_count/float(x)) * 100))) 105 | plt.axhline(0, color = 'r') 106 | plt.ylabel('Account Value') 107 | plt.xlabel('Wager Count') 108 | plt.show() 109 | 110 | 111 | -------------------------------------------------------------------------------- /montecarlo8.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import random 4 | import matplotlib 5 | import matplotlib.pyplot as plt 6 | import time 7 | 8 | from matplotlib import style 9 | style.use("ggplot") 10 | 11 | ''' 12 | Since we will be comparing bettors, and eventually maybe have a handful, 13 | it would be wise to just set the starting funds, wager size, and wager 14 | count ahead of time globally. 15 | ''' 16 | 17 | sampleSize = 100 18 | 19 | startingFunds = 10000 20 | wagerSize = 1000 21 | wagerCount = 1000 22 | 23 | 24 | 25 | 26 | def rollDice(): 27 | roll = random.randint(1,100) 28 | 29 | if roll == 100: 30 | return False 31 | elif roll <= 50: 32 | return False 33 | elif 100 > roll >= 50: 34 | return True 35 | 36 | 37 | def doubler_bettor(funds,initial_wager,wager_count): 38 | 39 | value = funds 40 | wager = initial_wager 41 | wX = [] 42 | vY = [] 43 | currentWager = 1 44 | previousWager = 'win' 45 | previousWagerAmount = initial_wager 46 | 47 | while currentWager <= wager_count: 48 | if previousWager == 'win': 49 | if rollDice(): 50 | value += wager 51 | wX.append(currentWager) 52 | vY.append(value) 53 | else: 54 | value -= wager 55 | previousWager = 'loss' 56 | previousWagerAmount = wager 57 | wX.append(currentWager) 58 | vY.append(value) 59 | if value < 0: 60 | currentWager += 10000000000000000 61 | elif previousWager == 'loss': 62 | if rollDice(): 63 | wager = previousWagerAmount * 2 64 | value += wager 65 | wager = initial_wager 66 | previousWager = 'win' 67 | wX.append(currentWager) 68 | vY.append(value) 69 | else: 70 | wager = previousWagerAmount * 2 71 | value -= wager 72 | previousWager = 'loss' 73 | previousWagerAmount = wager 74 | wX.append(currentWager) 75 | vY.append(value) 76 | if value < 0: 77 | currentWager += 10000000000000000 78 | 79 | currentWager += 1 80 | # this guy goes cyan # 81 | plt.plot(wX,vY,'c') 82 | 83 | 84 | ''' 85 | xx = 0 86 | broke_count = 0 87 | 88 | while xx < 1000: 89 | doubler_bettor(10000,100,100) 90 | xx+=1 91 | 92 | print 'death rate:',(broke_count/float(xx)) * 100 93 | print 'survival rate:',100 - ((broke_count/float(xx)) * 100) 94 | plt.axhline(0, color = 'r') 95 | plt.show() 96 | time.sleep(555) 97 | ''' 98 | 99 | 100 | 101 | ''' 102 | Simple bettor, betting the same amount each time. 103 | ''' 104 | ##### color# 105 | def simple_bettor(funds,initial_wager,wager_count,color): 106 | #### 107 | 108 | value = funds 109 | wager = initial_wager 110 | wX = [] 111 | vY = [] 112 | currentWager = 1 113 | while currentWager <= wager_count: 114 | if rollDice(): 115 | value += wager 116 | wX.append(currentWager) 117 | vY.append(value) 118 | else: 119 | value -= wager 120 | wX.append(currentWager) 121 | vY.append(value) 122 | 123 | ###add me 124 | if value < 0: 125 | currentWager += 10000000000000000 126 | currentWager += 1 127 | 128 | # this guy goes green # 129 | plt.plot(wX,vY,color) 130 | 131 | 132 | x = 0 133 | 134 | while x < sampleSize: 135 | simple_bettor(startingFunds,wagerSize,wagerCount,'k') 136 | simple_bettor(startingFunds,wagerSize*2,wagerCount,'c') 137 | #doubler_bettor(startingFunds,wagerSize,wagerCount) 138 | x+=1 139 | 140 | plt.axhline(0, color = 'r') 141 | plt.ylabel('Account Value') 142 | plt.xlabel('Wager Count') 143 | plt.show() 144 | 145 | 146 | -------------------------------------------------------------------------------- /montecarlo9.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | import matplotlib 4 | import matplotlib.pyplot as plt 5 | import time 6 | 7 | from matplotlib import style 8 | style.use("ggplot") 9 | 10 | sampleSize = 100 11 | 12 | startingFunds = 10000 13 | wagerSize = 100 14 | wagerCount = 1000 15 | 16 | 17 | 18 | 19 | def rollDice(): 20 | roll = random.randint(1,100) 21 | 22 | if roll == 100: 23 | return False 24 | elif roll <= 50: 25 | return False 26 | elif 100 > roll >= 50: 27 | return True 28 | 29 | ################################################## edit in color 30 | def doubler_bettor(funds,initial_wager,wager_count,color): 31 | 32 | value = funds 33 | wager = initial_wager 34 | wX = [] 35 | vY = [] 36 | currentWager = 1 37 | previousWager = 'win' 38 | previousWagerAmount = initial_wager 39 | 40 | while currentWager <= wager_count: 41 | if previousWager == 'win': 42 | if rollDice(): 43 | value += wager 44 | wX.append(currentWager) 45 | vY.append(value) 46 | else: 47 | value -= wager 48 | previousWager = 'loss' 49 | previousWagerAmount = wager 50 | wX.append(currentWager) 51 | vY.append(value) 52 | if value < 0: 53 | currentWager += 10000000000000000 54 | elif previousWager == 'loss': 55 | if rollDice(): 56 | wager = previousWagerAmount * 2 57 | 58 | # this makes it so we just bet all that is left. 59 | if (value - wager) < 0: 60 | wager = value 61 | 62 | value += wager 63 | wager = initial_wager 64 | previousWager = 'win' 65 | wX.append(currentWager) 66 | vY.append(value) 67 | else: 68 | wager = previousWagerAmount * 2 69 | # this makes it so we just bet all that is left. 70 | if (value - wager) < 0: 71 | wager = value 72 | value -= wager 73 | previousWager = 'loss' 74 | previousWagerAmount = wager 75 | wX.append(currentWager) 76 | vY.append(value) 77 | 78 | 79 | # change to equals zero! 80 | if value <= 0: 81 | currentWager += 10000000000000000 82 | 83 | currentWager += 1 84 | ########################### this guy edits color # 85 | plt.plot(wX,vY,color) 86 | 87 | 88 | ''' 89 | Simple bettor, betting the same amount each time. 90 | ''' 91 | ##### color# 92 | def simple_bettor(funds,initial_wager,wager_count,color): 93 | 94 | 95 | value = funds 96 | wager = initial_wager 97 | wX = [] 98 | vY = [] 99 | currentWager = 1 100 | while currentWager <= wager_count: 101 | if rollDice(): 102 | value += wager 103 | wX.append(currentWager) 104 | vY.append(value) 105 | else: 106 | value -= wager 107 | wX.append(currentWager) 108 | vY.append(value) 109 | 110 | ### change this part, not lessthan or equal zero, it is zero 111 | if value <= 0: 112 | currentWager += 10000000000000000 113 | currentWager += 1 114 | 115 | # this guy goes green # 116 | plt.plot(wX,vY,color) 117 | 118 | 119 | x = 0 120 | 121 | while x < sampleSize: 122 | simple_bettor(startingFunds,wagerSize,wagerCount,'c') 123 | #simple_bettor(startingFunds,wagerSize*2,wagerCount,'c') 124 | doubler_bettor(startingFunds,wagerSize,wagerCount,'k') 125 | x+=1 126 | 127 | plt.axhline(0, color = 'r') 128 | plt.ylabel('Account Value') 129 | plt.xlabel('Wager Count') 130 | plt.show() 131 | 132 | 133 | --------------------------------------------------------------------------------