Our instructions assume that you have Python 2.7 and Homebrew installed on your machine. In order to use our system, you must download and install the OpenAI Gym, the FCEUX Nintendo Entertainment System emulator, and the Gym Super Mario environment. Then, open a bash shell, run the following commands.
pip install gym
pip install gym-pull
brew upgrade
brew install homebrew/games/fceux
Once this is completed, open a python shell and run the following.
import gym
import gym_pull
gym_pull.pull('github.com/ppaquette/gym-super-mario@gabegrand')
Assuming everything installs correctly, navigate to src/. You can set the hyperparameters as you wish in hyperparameters.py, and then run test.py (which will launch the emulator and use our code for training). Finally, you can kill the processes via Control-C in the Python terminal, or running ./mario.sh in the src directory.
-
abstractAgent.pycontains abstract classAbstractAgentfor ensuring that all Q agents conform to the same methods. -
approxQAgent.pycontains classApproxQAgent, which implements Approximate Q Learning algorithm. Inherits from AbstractAgent. -
approxSarsaAgent.pycontains classApproxSarsaAgent, which implements Approximate SARSA algorithm. Inherits from ApproxQAgent. -
feature_tests.pyis a scrapwork file for testing feature functionality for approximation algorithms. -
features.pycontains the feature functions used for approximation algorithms. -
heuristicAgent.pycontains classHeuristicAgent, which implements the basline Heuristic Agent described in our report. -
hyperparameters.pycontains the hyperparameters set for testing, including number of iterations, level, agent type, and agent specific parameters. -
qAgent.pycontains classQLearningAgent, which implements Exact Q Learning algorithm. Inherits from AbstractAgent. -
randomAgent.pycontains the classesRandomAgentand childWeightedRandomAgent, which implement the basline random agents described in our report. -
rewardModel.pycontains the functions that handle different scenarios for the reward function. -
test.pycontains the main method from which testing is run. -
util.pycontains the self-implemented state class, as well as the distribution utility code available via John DeNero and Dan Klein's UC Berkeley AI materials. For more information, see http://ai.berkeley.edu. -
kill-mario.shis used withintest.pyto kill the FCEUX process. -
mario.shcan be used to starttest.pyas a background process. It also killstest.pyand the FCEUX application when they are active.