This commit is contained in:
Daochen Zha 2021-05-27 13:31:56 -05:00
parent 21e3ead424
commit 1b6b8cbdf2
8 changed files with 18 additions and 14 deletions

View File

@ -4,6 +4,7 @@ This is the GUI support for the [RLCard](https://github.com/datamllab/rlcard) pr
* Official Website: [http://www.rlcard.org](http://www.rlcard.org) * Official Website: [http://www.rlcard.org](http://www.rlcard.org)
* Tutorial in Jupyter Notebook: [https://github.com/datamllab/rlcard-tutorial](https://github.com/datamllab/rlcard-tutorial) * Tutorial in Jupyter Notebook: [https://github.com/datamllab/rlcard-tutorial](https://github.com/datamllab/rlcard-tutorial)
* Paper: [https://www.ijcai.org/Proceedings/2020/764](https://www.ijcai.org/Proceedings/2020/764) * Paper: [https://www.ijcai.org/Proceedings/2020/764](https://www.ijcai.org/Proceedings/2020/764)
* Document: [click here](docs/README.md)
## Cite this work ## Cite this work
If you find this repo useful, you may cite: If you find this repo useful, you may cite:
@ -25,7 +26,7 @@ If you find this repo useful, you may cite:
``` ```
## Installation ## Installation
RLCard-Showdown has separated frontend and backend. The frontend is built with React and the backend is based on Django. RLCard-Showdown has separated frontend and backend. The frontend is built with React and the backend of leaderboard is based on Django.
### Prerequisite ### Prerequisite
To set up the frontend, you should make sure you have [Node.js](https://nodejs.org/) and NPM installed. Normally you just need to manually install Node.js, and the NPM package would be automatically installed together with Node.js for you. Please refer to its official website for installation of Node.js. To set up the frontend, you should make sure you have [Node.js](https://nodejs.org/) and NPM installed. Normally you just need to manually install Node.js, and the NPM package would be automatically installed together with Node.js for you. Please refer to its official website for installation of Node.js.
@ -35,34 +36,34 @@ You can run the following commands to verify the installation
node -v node -v
npm -v npm -v
``` ```
For backend, make sure that you have **Python 3.5+** and **pip** installed. For backend, make sure that you have **Python 3.6+** and **pip** installed.
### Install Frontend and Backend ### Install Frontend and Backend
The frontend can be installed with the help of NPM: The frontend can be installed with the help of NPM:
``` ```
git clone https://github.com/datamllab/rlcard-showdown.git git clone --depth 1 https://github.com/datamllab/rlcard-showdown.git
cd rlcard-showdown cd rlcard-showdown
npm install npm install
``` ```
The backend can be installed with The backend of leaderboard can be installed with
``` ```
pip install -r requirements.txt pip3 install -r requirements.txt
cd server cd server
python manage.py migrate python3 manage.py migrate
cd .. cd ..
``` ```
### Run RLCard-Showdown ### Run RLCard-Showdown
Launch the backend with Launch the backend of leaderboard with
``` ```
cd server cd server
python manage.py runserver python3 manage.py runserver
``` ```
Run the following command in a new terminal under the project folder to start frontend in development mode: Run the following command in a new terminal under the project folder to start frontend in development mode:
``` ```
npm start npm start
``` ```
The frontend will be started in port 3000 in localhost by default. You can view it at [http://127.0.0.1:3000/](http://127.0.0.1:3000/). The backend will run by default in [http://127.0.0.1:8000/](http://127.0.0.1:8000/). You can view frontend at [http://127.0.0.1:3000/](http://127.0.0.1:3000/). The backend of leaderboard will run in [http://127.0.0.1:8000/](http://127.0.0.1:8000/).
More documentation can be found [here](docs/api.md). User guide is [here](docs/guide.md). More documentation can be found [here](docs/api.md). User guide is [here](docs/guide.md).
@ -73,7 +74,7 @@ More documentation can be found [here](docs/api.md). User guide is [here](docs/g
![leduc-replay](https://github.com/datamllab/rlcard-showdown/blob/master/docs/imgs/leduc-replay.png?raw=true) ![leduc-replay](https://github.com/datamllab/rlcard-showdown/blob/master/docs/imgs/leduc-replay.png?raw=true)
### Contact Us ### Contact Us
If you have any questions or feedback, feel free to drop an email to [Songyi Huang](mailto:songyih@sfu.ca) for the frontend or [Daochen Zha](http://dczha.com/) for backend. If you have any questions or feedback, feel free to drop an email to [Songyi Huang](https://github.com/hsywhu) for the frontend or [Daochen Zha](https://github.com/daochenzha) for backend.
### Acknowledgements ### Acknowledgements
We would like to thank JJ World Network Technology Co., LTD for the generous support, [Chieh-An Tsai](https://anntsai.myportfolio.com/) for user interface design, and [Lei Pan](mailto:lpa25@sfu.ca) for the help in visualizations. We would like to thank JJ World Network Technology Co., LTD for the generous support, [Chieh-An Tsai](https://anntsai.myportfolio.com/) for user interface design, and [Lei Pan](mailto:lpa25@sfu.ca) for the help in visualizations.

4
docs/README.md Normal file
View File

@ -0,0 +1,4 @@
# Document of RLCard-Showdown
* [User Guide](guide.md)
* [API Document of Leaderboard](leaderboard_api.md)

View File

@ -1,8 +1,7 @@
rlcard rlcard[training]
Django Django
tqdm tqdm
django-cors-headers django-cors-headers
torch==1.6.0
flask==1.1 flask==1.1
flask-cors flask-cors
onnx onnx

Binary file not shown.

View File

@ -89,7 +89,7 @@ def doudizhu_tournament(game, agents, names, num_eval_games):
data['moveHistory'].append(history) data['moveHistory'].append(history)
state, player_id = env.step(action, env.agents[player_id].use_raw) state, player_id = env.step(action, env.agents[player_id].use_raw)
data = json.dumps(data) data = json.dumps(str(data))
#data = json.dumps(data, indent=2, sort_keys=True) #data = json.dumps(data, indent=2, sort_keys=True)
json_data.append(data) json_data.append(data)
if env.get_payoffs()[0] > 0: if env.get_payoffs()[0] > 0:
@ -150,7 +150,7 @@ def leduc_holdem_tournament(game, agents, num_eval_games):
round_history = [] round_history = []
perfect = env.get_perfect_information() perfect = env.get_perfect_information()
data['publicCard'] = perfect['public_card'] data['publicCard'] = perfect['public_card']
data = json.dumps(data) data = json.dumps(str(data))
#data = json.dumps(data, indent=2, sort_keys=True) #data = json.dumps(data, indent=2, sort_keys=True)
json_data.append(data) json_data.append(data)
if env.get_payoffs()[0] > 0: if env.get_payoffs()[0] > 0: