5 ms·
Monte Carlo methods
- johnfarrelldev 3y agoI haven't completed or deployed it yet but I wrote a C# API to calculate your chance of winning a hand of poker based on all known cards at the table. All unknown cards are randomly assigned and it just loops a bunch, reasonably easy to implement and actually is reasonably fast. https://github.com/JohnFarrellDev/PokerMonteCarloAPI/ https://github.com/JohnFarrellDev/PokerMonteCarloAPI/ With the amount of possible outcomes Bayesian statistics just didn't seem reasonable to implement. Goes without saying this tool is still fairly basic, it shouldn't be used to inform how much to bet or when to fold as it doesn't take into account information such as how much your opponents are betting.
- gmi01 3y agoI wrote a Haskell version that includes two components: A very efficient function to rank a set of Texas Hold’em hands. A Monte Carlo situation that gives you the probability of winning each hand from any known amount of information. It is available here: https://github.com/ghais/poker https://github.com/ghais/poker
- bionsystem 3y agoNot sure if you guys are aware but there are solvers existing (most of which are proprietary) that actually give optimal strategies with every possible hands given a betting pattern. They are used extensively as study tools by professional players.
- SnowHill9902 3y agoCan you link to some projects? Ideally also Haskell or also functional?
- bionsystem 3y agoI use GTO+ which is proprietary. I just tried this one which works like a charm (just run the exe from the zip in github releases ; even comes pre-loaded with a wide amount of preflop ranges, which seem to come from a previous solve) : https://github.com/bupticybee/TexasSolver https://github.com/bupticybee/TexasSolver Searching with "poker solver haskell" only seem to show very immature projects.
- IngoBlechschmid 3y agoVery nicely polished! Thank you for sharing! For the purposes of teaching Python, I once created something similar---but without the explanations: https://www.speicherleck.de/iblech/zufall-im-browser/index.en.html https://www.speicherleck.de/iblech/zufall-im-browser/index.e...
- uoaei 3y agoA closely related idea is Approximate Bayesian Computation: https://www.sumsar.net/blog/2014/10/tiny-data-and-the-socks-of-karl-broman/ https://www.sumsar.net/blog/2014/10/tiny-data-and-the-socks-...
- tommica 3y agoThis is so cool - simple and educative!
- winddude 3y agoFun! and just as "21" taught us card counting is always the answer.
- giantg2 3y agoVery cool. At first I thought this would be about project management using Monte Carlo for target dates.
- kenniskrag 3y agoWhat's about online poker. Is there also a bank advantage if you play perfectly? Is it allowed?
- zer0tonin 3y agohttps://en.wikipedia.org/wiki/Rake_(poker) https://en.wikipedia.org/wiki/Rake_(poker)
- travisjungroth 3y agoPoker is quite different. In roulette, the house advantage is probabilistic. As the linked page shows, that advantage is overwhelmingly likely to materialize, and rather quickly at that. But the probability that you play a million rounds of roulette and end up ahead isn’t exactly zero, just such a ridiculously small number you might as well call it zero for real life purposes. Casinos make money on poker play differently, and in a few ways. The simplest is “rake”. They take a fixed percentage of every pot. This is different because it’s not probabilistic. The casino isn’t gambling its own money. It’s just a tax. Money only comes in from players. So the EV of all players is negative, because a little is flowing out to the casino every hand. The chance players as a whole end up ahead isn’t near zero, it is zero. If everyone was playing theoretically perfect poker every hand, all individual players EV are also negative. But, no one is playing perfect all the time. So you can get ahead because you’re not beating the odds. You’re beating other players.
- opensourceac 3y agoJust finished embedding a Python component on my site - https://www.actuarialopensource.org/book/welcome https://www.actuarialopensource.org/book/welcome. Uses react-py. Some effort required to implement tabs and manage lifecycle of Pyodide for separate editors.
- afterburner 3y agoOn the following blackjack page (link at the bottom of the page), the phrase "Buy up to 17" can be misleading. The author means "if your total is 17 or less, get another card". But it can easily be interpreted as "keep asking for more cards until you have 17 or more"; almost the same, but different.
- deleted 3y ago[deleted]
- aaron695 3y agoThis is wrong. Monte Carlo has nothing to do with gambling, historically or in mathematics. Historically it was about playing solitaire and casinos also have cards. Monte Carlo is more like AI. It looks at the world and returns with intuitive answers. Except it's intuition is billions of times better than yours. As an example I proved this HN post wrong using Monto Carlo - The Mystery of the Frog Riddle - https://news.ycombinator.com/item?id=32490611 https://news.ycombinator.com/item?id=32490611 I've deleted the code but write your own and check.
- tonetheman 3y agoReally nice presentation/learning page. Being able to change the code on the fly is also nice.
- deleted 3y ago[deleted]
- chkas 3y agoHi. Author here. It is shown here on different in the browser executable and editable programs with Monte Carlo methods that one cannot win at roulette if one plays many times. Many know this, but many do not, and therefore this can be helpful. After all, there are more than a few who lose their financial existence in the casino.
- iamcreasy 3y agoThank you for writing. Very clearly explained. Can you explain how do you derive this? print 10 * 10000 * (18 / 37 - 19 / 37)
- alexeldeib 3y agoPer round expected value of +/- 10, times 10k rounds, 18/37 lose probability 19/37 win probability.
- Jtsummers 3y agoThat's an expected value calculation. It breaks down into three parts: 1. The wager per round ($10). This is, in the game being simulated, the amount won or lost based on the game's outcome. 2. The number of rounds (10000). 3. The probability of winning minus probability of losing. Forgetting the number of rounds for a moment, the way to calculate the expected value of a single wager like this is: E[X] = x1*p1 + x2*p2 + ... + xn*pn Where each `xN` is the value (amount won or amount lost since we're talking about wagers) of an event and `pN` is the probability of that event. In this case there is an 18/37 chance of winning and 19/37 chance of losing. The value of winning is +10 and the cost of losing is -10. So the expected value of a $10 wager ends up being: 10 * 18/37 - 10 * 19/37 Multiply that by 10,000 for the number of rounds played and you get the expected value of a series of games.
- sokoloff 3y agoNote that's the calculation for a European (single green 0) wheel, not the American (green 0 and green 00) wheel, in which you'd replace with +18/38 (or 9/19) and -20/38 (or 10/19). Yes, the American version is twice as bad for the player, but it doesn't matter; people are still plenty eager to play it...
- abecedarius 3y agoI love how lightweight and interactive this is. Related: Norvig's runnable intro probability notebooks at https://github.com/norvig/pytudes#pytudes-index-of-jupyter-ipython-notebooks https://github.com/norvig/pytudes#pytudes-index-of-jupyter-i...
- adancalderon 3y agoWe can do math integration and solve radiation transport problems with Monte Carlo.
- acidburnNSA 3y agoIt was actually invented for this. Open source radiation transport Monte Carlo code here if you'd like to play around: https://github.com/openmc-dev/openmc https://github.com/openmc-dev/openmc
- eodhosb 3y agoand ENIAC's first programs were Monte Carlo simulations.
- CyberDildonics 3y agoAny integral you can sample can be solved with monte carlo methods. This doesn't really have anything to do with the link.
- spookystats 3y agoActually it does, because MC integration works due to the law of large numbers - exactly what is presented in the article.
- CyberDildonics 3y agoRight, that's what is in the article, but just naming a random arbitrary use doesn't make any sense.
- brickteacup 3y agoSome people actually find learning new things to be interesting and would therefore appreciate a comment giving them a new avenue of exploration to pursue.
- 3y ago
- listenallyall 3y agoDiscussed multiple times before: https://news.ycombinator.com/item?id=20359100 https://news.ycombinator.com/item?id=20359100 https://news.ycombinator.com/item?id=29217539 https://news.ycombinator.com/item?id=29217539 https://news.ycombinator.com/item?id=35927627 https://news.ycombinator.com/item?id=35927627