# playing-mario-with-deep-reinforcement-learning **Repository Path**: AngryPanda_XYZ/playing-mario-with-deep-reinforcement-learning ## Basic Information - **Project Name**: playing-mario-with-deep-reinforcement-learning - **Description**: 使用强化学习算法玩mario游戏 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: https://github.com/Kautenja/playing-mario-with-deep-reinforcement-learning - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2021-07-01 - **Last Updated**: 2024-06-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: 待处理的项目 ## README # Playing Super Mario Bros. With Deep Reinforcement Learning [![Build Status](https://travis-ci.com/Kautenja/playing-mario-with-deep-reinforcement-learning.svg?branch=master)](https://travis-ci.com/Kautenja/playing-mario-with-deep-reinforcement-learning) Using (Double/Dueling) Deep-Q Networks to play Super Mario Bros. ![DDQN-SMB-1-4](https://user-images.githubusercontent.com/2184469/113493396-8e6d3080-94a4-11eb-8e4c-956c277ac76f.gif) # Installation ## `virtualenv` Use `virtualenv` to contain the Python environment to a single local installation of python3: #### Setup To setup the virtual environment: ```shell virtualenv -p python3 .env source .env/bin/activate ``` When you've concluded the session: ```shell deactivate ``` ## Dependencies [requirements.txt](requirements.txt) lists the Python dependencies for the project with frozen versions. To install dependencies: ```shell python -m pip install -r requirements.txt ``` **NOTE** if you're NOT using `virtualenv`, ensure that `python` aliases python3; python2 is not supported. # Usage The following instructions assume you have a shell running at the top level directory of the project. For comprehensive documentation on command line options, run the following: ```shell python . -h ``` ## Test Cases To execute the `unittest` suite for the project run: ```shell python -m unittest discover . ``` ## Random Agent To play games with an agent that makes random decisions: ```shell python . -m random -e ``` - `` is the ID of the environment to play randomly. ### Example For instance, to play a random agent on Pong: ```shell python . -m random -e Pong ``` ## Training A Deep-Q Agent To train a Deep-Q agent to play a game: ```shell python . -m train -e ``` - `` is the ID of the environment to train on. ### Example For instance, to train a Deep-Q agent on Pong: ```shell python . -m train -e Pong ``` ## Playing With A Trained Agent To run a trained Deep-Q agent on validation games: ```shell python . -m play -o ``` - `` is a directory containing a `weights.h5` file from a training session ### Example For instance, to play a Deep-Q agent on Pong: ```shell python . -m play -e results/Pong/DeepQAgent/2018-06-07_09-24 ``` ======================================== 原始的配置环境有一定问题,经过修改后可以按照如下方式进行配置:(亲测可运行) conda+pip配置环境: conda create -n test python=3.6 conda activate test conda install tensorflow-gpu==1.15.0 pip install -r requirements.txt 测试: python -m unittest discover . python . -m random -e Pong