Assignment 1: Super Mario Bros.

You can download our Java implementation of this game from the Git repository MarioAI. When you visit that page on GitHub, be sure to read the entire page – it has lots of useful information about the game, including a link to the API documentation.

You can load the Java sources into any major Java IDE. Especially if you are new to Java, I recommend Visual Studio Code. It is a lightweight IDE that works well with Java and many other languages, and I find it especially easy to use. Of course, if you prefer Eclipse or IntelliJ, they will work well too.

Quick start with Visual Studio Code

Here is the easiest way to get started on this assignment using Visual Studio Code:

1. Install the Java Development Kit (JDK). On Linux, you should get this from for your package manager. For example, on Ubuntu all you need to do is to install the default-jdk package. On macOS or Windows, go to Oracle's Java downloads page and download an installer from there.

2. Visit the Visual Studio Code page and download and install it.

3. Clone the MarioAI repository:

$ git clone https://github.com/medovina/MarioAI.git

4. Start Visual Studio Code.

5. Choose the File/Open Folder menu command. Navigate to the MarioAI directory generated by git clone and click OK.

6. In the Explorer area on the left, double click any Java source file (e.g. src/MyAgent.java) to open it.

7. In the lower right, you'll see a message

The 'Java' extension pack is recommended for this file type.

Click the Install button below this message. Wait a few moments for the install to complete.

8. Choose View → Terminal to open a terminal window inside Visual Studio Code.

9. On Linux or macOS, run

$ ./mario

Or, on Windows:

> .\mario

The game will launch, and you will be able to play it from the keyboard.

10. In the Explorer on the left, navigate to src/MyAgent.java and open it. This is the source file where you will write your agent code.

If you run into problems or have questions, just let me know.

You can use a similar sequence of steps to get started in other IDEs such as Intelli/J.

Earning points for this assignment

The game generates each level randomly, so your agent might succeed on some randomly generated levels and fail on others. ReCodEx will evaluate your agent on a series of levels generated in several configurations:

Your agent succeeds if it makes it to the end of each level, and fails otherwise. Its success rate is the fraction of randomly generated levels on which it succeeds.

To see your agent run once on any of the above levels, specify it on the command line:

$ ./mario MyAgent -level 2

To evaluate your agent's success rate, use the -sim option, which will run your agent automatically (without a graphical interface) in many random games in succession. For example:

$ ./mario MyAgent -level 2 -sim 30

See the documentation on GitHub for more information about available command-line parameters.

This assignment is worth a total of 10 points. You can earn them as follows:

Do not forget that Mario can both jump and shoot! :)

The tournament for this assignment will have two categories.

In each category, I will compute the 1st, 2nd, and 3rd place winners, as well as a list of students who were in the top 30% of all submissions. I will award ReCodEx bonus points (1st = 15 pts, 2nd = 10 pts, 3rd = 8 pts, top 30% = 5 pts) to each student based on the category in which they had the higher achievement.