Skip to main content

A Toolkit for Reinforcement Learning in Card Games

Project description

RLCard: A Toolkit for Reinforcement Learning in Card Games

Build Status Codacy Badge Coverage Status

RLCard is a toolkit for Reinforcement Learning (RL) in card games. It supports multiple card environments with easy-to-use interfaces. The goal of RLCard is to bridge reinforcement learning and imperfect information games, and push forward the research of reinforcement learning in domains with multiple agents, large state and action space, and sparse reward. RLCard is developed by DATA Lab at Texas A&M University.

Installation

Make sure that you have Python 3.5+ and pip installed. We recommend installing rlcard with pip as follow:

git clone https://github.com/datamllab/rlcard.git
cd rlcard
pip install -e .

Or you can directly install the package with

pip install rlcard

Examples

Please refer to examples/. A short example is as below.

import rlcard
from rlcard.agents.random_agent import RandomAgent

env = rlcard.make('blackjack')
env.set_agents([RandomAgent()])

trajectories, payoffs = env.run()

We also recommend the following toy examples.

Demo

Run examples/leduc_holdem_human.py to play with the pre-trained Leduc Hold'em model:

>> Leduc Hold'em pre-trained model

>> Start a new game!
>> Agent 1 chooses raise

=============== Community Card ===============
┌─────────┐
│░░░░░░░░░│
│░░░░░░░░░│
│░░░░░░░░░│
│░░░░░░░░░│
│░░░░░░░░░│
│░░░░░░░░░│
│░░░░░░░░░│
└─────────┘
===============   Your Hand    ===============
┌─────────┐
│J        │
│         │
│         │
│    ♥    │
│         │
│         │
│        J│
└─────────┘
===============     Chips      ===============
Yours:   +
Agent 1: +++
=========== Actions You Can Choose ===========
0: call, 1: raise, 2: fold

>> You choose action (integer):

Documents

Please refer to the Documents for general introductions. API documents are available at our website.

Available Environments

We provide a complexity estimation for the games on several aspects. InfoSet Number: the number of information set; Avg. InfoSet Size: the average number of states in a single information set; Action Size: the size of the action space. Name: the name that should be passed to env.make to create the game environment.

Game InfoSet Number Avg. InfoSet Size Action Size Name Status
Blackjack (wiki, baike) 10^3 10^1 10^0 blackjack Available
Leduc Hold’em 10^2 10^2 10^0 leduc-holdem Available
Limit Texas Hold'em (wiki, baike) 10^14 10^3 10^0 limit-holdem Available
Dou Dizhu (wiki, baike) 10^53 ~ 10^83 10^23 10^4 doudizhu Available
Mahjong (wiki, baike) 10^121 10^48 10^2 mahjong Available
No-limit Texas Hold'em (wiki, baike) 10^162 10^3 10^4 no-limit-holdem Available
UNO (wiki, baike) 10^163 10^10 10^1 uno Available
Sheng Ji (wiki, baike) 10^157 ~ 10^165 10^61 10^11 - Developing

Evaluation

The perfomance is measured by winning rates through tournaments. Example outputs are as follows: Learning Curves

Contributing

Contribution to this project is greatly appreciated! Please create a issue for feedbacks/bugs. If you want to contribute codes, pleast contact daochen.zha@tamu.edu or khlai037@tamu.edu.

Acknowledgements

We would like to thank JJ World Network Technology Co.,LTD for the technical support.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rlcard-0.1.3.tar.gz (64.9 kB view details)

Uploaded Source

File details

Details for the file rlcard-0.1.3.tar.gz.

File metadata

  • Download URL: rlcard-0.1.3.tar.gz
  • Upload date:
  • Size: 64.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.4

File hashes

Hashes for rlcard-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f64e47cf82a7648c5dabf7564127c319a406c785e0c2b52812c1f9d18a099dd3
MD5 edf39535f53b6846ffb77a5fe78aa876
BLAKE2b-256 cf16c17215d4d322f7f869feca23a357885529dc583f1c7ab851687daa48c49b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page