CS 182 Artificial Intelligence Final Project
By Gabe Grand and Kevin Loughlin
Setup instructions for Mac
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.
Source file breakdown
abstractAgent.pycontains abstract class
AbstractAgentfor ensuring that all Q agents conform to the same methods.
ApproxQAgent, which implements Approximate Q Learning algorithm. Inherits from AbstractAgent.
ApproxSarsaAgent, 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, 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.
QLearningAgent, which implements Exact Q Learning algorithm. Inherits from AbstractAgent.
randomAgent.pycontains the classes
WeightedRandomAgent, 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 within
test.pyto kill the FCEUX process.
mario.shcan be used to start
test.pyas a background process. It also kills
test.pyand the FCEUX application when they are active.