Setting up Bots with Eclipse

 

 

1                             Start up Eclipse with a nice clean workbench.  (The workbench location tells Eclipse where to save files.)

2                             If you like, put the bot jar in the directory created by making your Workbench.

3                             Start a new project.

a.         File->New Project

b.         Select ÒJava ProjectÓ

c.         Select a name.  I chose ÒbotsÓ. 

d.         Be sure to hit ÒnextÓ to get to the library configuration for the next part.

 

4                             Adding the bot jar to the classpath for that Project

a.         If you clicked ÒfinishÓ then go to the ÒProjectÓ menu and choose ÒPreferencesÓ.

b.         Click on the ÒlibrariesÓ tab in the ÒJava SettingsÓ window. 

c.         Choose Òexternal JarÓ and find the bot.jar file.

 

 

5                             Make a new Bot!

a.         Choose ÒNew ClassÓ from the File menu.

b.         Type in the name of the bot.

c.         Make it extend the Òbot.BotÓ class.

d.         Click finish.  It will open up a new file with your botÕs skeleton. 

 

6                             Here is sample code for a trivial bot:

import bot.Bot;

 

 

public class TestBot extends Bot {

 

              @Override

              public void compute() {

                            say("Rock my world!");

              }

 

}

 

7                             Running the bot:

a.         Choose ÒRunÉÓ from the ÒRunÓ menu.

b.         Enter in Òbot.RunnerÓ as the name of the main class.

c.         Click okay.  The runner will start up and ask for the name of your bot.

d.         Type in the name of the bot you just wrote.  In the above example, this is ÒTestBot.Ó

e.         Next it will ask for the name of the board.  Try Òbot.gen.MazeÓ or Òbot.gen.RoomÓ

 

8                             In the bot world

a.         Go runs the program

b.         Step runs one step of the botÕs commands (i.e. it pauses every time a bot action is taken).

c.         Stop will end the program.

d.         Once the program is over, you can reset it.

e.         The bottom tracks number of steps.  The slider controls how fast it runs.

f.           The top allows you to change boards, bots, etc.