Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pkx8326/blackjack-weighted-random-choices-visualization-with-numpy-and-python
This is a small project to test and visualize the result of the weighted probability capability of Python's numpy.random.choice()
https://github.com/pkx8326/blackjack-weighted-random-choices-visualization-with-numpy-and-python
blackjack blackjack-game choice jupyter-notebook numpy python random weighted-probability weighted-random
Last synced: about 1 month ago
JSON representation
This is a small project to test and visualize the result of the weighted probability capability of Python's numpy.random.choice()
- Host: GitHub
- URL: https://github.com/pkx8326/blackjack-weighted-random-choices-visualization-with-numpy-and-python
- Owner: pkx8326
- Created: 2022-02-09T10:32:40.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-09T11:15:20.000Z (about 3 years ago)
- Last Synced: 2024-11-13T11:41:34.796Z (3 months ago)
- Topics: blackjack, blackjack-game, choice, jupyter-notebook, numpy, python, random, weighted-probability, weighted-random
- Language: Jupyter Notebook
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blackjack-weighted-random-choices-visualization-with-numpy-and-Python
This is a small project to test and visualize the result of the weighted probability capability of Python's numpy.random.choice().In any 2-player Blackjack game where the computer's the dealer, we need to consider the computer's decision to hit on the next card provided its current point. The closer the dealer's point to 21, the lesser the probability of it making a hit (drawing another card). The Python code in this repository reduces the probability of the computer to draw another card when its point is close to 21 with simple if-else algorithm and the help of numpy.random.choice()'s weighted probability capability.
In this case, if the point is less than or equal to 17, the probability of the computer to draw another card is 0.99, and decreases respectively to the increasing point. The probability of the computer to draw another card when its point is 21 is 0.
The following bar chart shows the times out of 100 times the computer will draw another card for each of its point:

The visualiztion can differ from what's shown here if the computer is given a different set of probabilities.