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.
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.
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:
LEVEL_1_JUMPING: terrain with hills, but no enemies
LEVEL_2_GOOMBAS: like LEVEL_1, but also with Goombas
LEVEL_3_TUBES: like LEVEL_2, but also with pipes with dangerous plants
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:
2 points: 95% success rate on LEVEL_1_JUMPING
4 points: 75% success rate on LEVEL_2_GOOMBAS
4 points: 75% success rate on LEVEL_3_TUBES
Do not forget that Mario can both jump and shoot! :)
The tournament for this assignment will have two categories.
In the first category we will use LEVEL_4_SPIKIES, which has hills, Goombas, pipes and Spikies. The winner in this category will be the agent with the highest success rate on this level.
In the second category we will use LEVEL_6_FULL_GAME, which is the full game that runs by default from the keyboard including coins, mushrooms and so on. The winner this category will be the agent with the highest average score.
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.