Skip to content

Latest commit

 

History

56 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blackjack custom Gymnasium environment game

Project focuses on a Blackjack game implementation using the Python library Gymnasium. The game environment can be used for reinforcement learning projects.

Currently, there are two versions of the Blackjack environment:

  • Blackjack4game-v0 - basic implementation with discrete action space
  • Blackjack4game-v1 - implementation featuring betting at the beggining of a game - where an agent can decide what percentage of money to bet (continuous action space)

Blackjack rules

Dice imageDice image

Note: The current implementation does not support SPLIT moves. Besides that, most other standard rules apply. There are still areas for improvement - some of them are marked with #TODO comment in the code.

Requirements

Usage

  1. Clone the repository:

    git clone https://github.com/jakseluz/blackjack_gym.git
    cd blackjack_gym
  2. Install project and its dependencies with:

    pip install -e .
    • (in the project root directory; see the point above)
  3. Use the environment in a selected version:

    import gymnasium as gym
    import blackjack_env
    
    # version 0 (see README description above)
    env = gym.make("Blackjack4game-v0", render_mode="terminal") # render_mode="human" if you want to use GUI (or None if neither)
    
    # version 1
    # env = gym.make("Blackjack4game-v1", render_mode="terminal")
    
    # use it like other gymnasium environments;
  4. To see how to use the gymnasium environment, see: gymnasium documentation.

  5. Check ./notebooks/ directory for the tutorial/ information:

    • ./notebooks/main.ipynb file - Blackjack4game-v0 tutorial ./notebooks/bet_example.ipynb file - additional info about Blackjack4game-v1 version
  6. More detailed analysis available (in Polish) in

  7. Result files used in learning etc. are located in ./results/:

Code

  1. The environment directory:
  2. Agent learning utilities.
  3. Wrappers used by the v1 version.

Authors

  • Jakub Łabuz (jakseluz) - Blackjack
  • Maciej Maj (mmaj1) - most of the tests and reports

Used resources:


For questions or contributions, please open an issue or submit a pull request!

About

Own Blackjack game environment, using Python Gymnasium

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages