How to Compile Robin Baumgarten's Mario Brothers Artificial Intelligence Java Application.


Basic instructions... assuming you are an experienced java coder.
First download the source code for the game itself.
Downloading a zip.
Extract the zip file.
Make a new directory for the Eclipse Workspace C:\eclipseworkspace
Here are the files you are going to yank into your new eclipse project.
first create the project.
Java Project.
name it whatever you want as long as it is rb_mario_ai
click finish.
Ok now we have a blank eclipse Java project.
Select all the items inside the extracted marioai folder. Copy them.
Paste them into your rb_mario_ai project. Overwrite any existing files/folders.
Press F5 on the project to see the files you yanked in.
The Play.java under ch.idsia.scenarios has the main() method we are interested in. But look there are errors.
An error, access restriction: the type ReflectionFactory is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_21\jre\lib\rt.jar
Basically you are trying to import something and there are restrictions on what you are importing.
Choose Window-> Preferences.
Choose java -> Compiler -> Errors/Warnings -> Depreciated and restricted API -> Discouraged reference (access rules)
Set that to "Warning" or "Ignore". I set it to Warning.
Rebuild the project, The errors are still there. But we ignore them.
More errors in Easy.java. The import org.jdom cannot be resolved.
Right click the project rb_mario_ai -> properties.
click add external Jars.
Go to this directory robin_baumgarten_mario_ai / lib
select jdom.jar and push open.
It gets sucked in.
no more errors there.
Run it as a java application.
Oh noes, Null Exception errors and Can't read input file. What file can't you read?
Here is a file that can't be read. Oh look a System.out.println, how nice. Uncomment that.
Uncommented. Run the program.
lol. Ok it's looking for the img folder at the same directory level as the folder that contains it. FAIL. well I can just MOVE the img folder. That would work.
Move the img folder from inside rb_mario_ai up one directory. Run the program.
Yeah now it works.
Joy. But no AI yet.
Download Robin Baumgarten's AI code.
Extract it.
This is what is inside it.
Copy the robinbaumgarten folder inside the rb_mario_ai/src/competition/cig folder, next to sergeykarakovskiy
Press F5 on the project name to see what has been pulled in.
Comment the line Agent controller = new HumanKeyboardAgent();
change it to this: Agent controller = new AStarAgent();
But it doesn't work, can't find it.
Right click to import the AStarAgent class implementation of Agent.
That added an import statement at the top.
Run the program. Mario blasts to the finish escaping dangerous situations with ease without user input! The machine, having been endowed with the very spirit of man.. should deserve a fair trial for choosing to kill the goombas.