wangwerrr / poker-monte-carlo Goto Github PK
View Code? Open in Web Editor NEWMonte Carlo Simulation for Texas Holdem
Monte Carlo Simulation for Texas Holdem
Now you are ready to put the whole program together! You have the file poker.py, which you will use to do the simulations. In particular, your program should take one or two command line arguments. The first is required and is the name of the input file to read. The second is optional and is the number of Monte Carlo trials to perform. If it is not given, you should use 10,000 as a default value. Your main poker.py should: - Check command line arguments/report errors. - Make a FutureCards and make hands from read_input, passing in the filename. - Create a deck with the remaining cards (you just wrote build_remaining_deck). - Create a list wins to count how many times each hand wins, with one more element for if there was a tie (so if there are two hands, you should have three elements). Initialize all its values to 0. - Do each Monte Carlo trial (repeat num_trials times). Hint: you want to abstract this out into a function! o Shuffle the deck of remaining cards o Assign unknown cards from the shuffled deck (you just wrote future_cards_from_deck) o Use compare_hands (from eval.py) to figure out which hand won. Note that with potentially more than two hands, this is much like finding the max of an array but using compare_hands instead of >. If two hands tie, you will need to keep track of the second one to compare the best and second best option at the end. o Increment the win count for the winning hand (or for the "ties" element of the list if there was a tie). - After you do all your trials, you just need to print your results (we provide print_results), as Python will automatically deallocate memory and close open files.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.