Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rauljordan/blackjack-rs
https://github.com/rauljordan/blackjack-rs
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rauljordan/blackjack-rs
- Owner: rauljordan
- Created: 2022-11-25T17:33:23.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-26T06:54:49.000Z (almost 2 years ago)
- Last Synced: 2023-08-09T14:36:16.924Z (over 1 year ago)
- Language: Rust
- Size: 16.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blackjack Rust Simulator
Runs a simulator written in Rust that can spawn N threads of blackjack games where the player
agent acts according to [basic strategy](https://www.vegashowto.com/blackjack-basic-strategy) and observes the results. It allows for customizing
the number of decks used where each deck is a standard, 52 card deck.
Basic strategy is known to work well in casinos with good odds, however, deck size can make a difference in the house edge.
Currently, the dealer must hit on soft 17 in the simulator, which affects RTP (return-to-player).## Running
Install Rust, then:
```
git clone https://github.com/rauljordan/blackjack-rs && cd blackjack-rs
cargo run -- -d=6 -n=10000
```Sample output:
```
Blackjack strategy simulator, sample game played:Winner: Some(Dealer)
Dealer hand: [Seven, Four, Seven] = 18
Player move(s): [Stand]
Player hand(s): ([Seven, Q], []) = 17*********************************************
* Testing effectiveness of 'basic strategy' *
*********************************************
Deck size: 6
Simulated games: 10000
Player wins: 36.96%
Dealer wins: 48.92%
Ties: 14.12%
```## TODOs
- [ ] Customize dealer soft hit or stand on 17
- [ ] Add in bets to calculate RTP
- [ ] Allow running multiple games for an initial bet and calculate RTP
- [ ] Each game reuses a same deck, but we should give each game its own shuffled deck
- [ ] Add soft strats (already includes hard and pair strats)