ABP for Java

I am Orange

This tutorial gives a basic overview of how to use the ABP for Java library with a simple wolf-rabbit hunting simulation/game.

These source files contain full program code for the above demo. We describe how to use it here.

After extracting the above file, to compile the example execute the command

      % javac -sourcepath src -cp abp.jar -d bin src/egs/wolves/Hunt.java

Run the program with

      % java -cp bin:abp.jar egs.wolves.Hunt
      % java -cp bin;abp.jar egs.wolves.Hunt
for Windows users

You will get a bunch of output showing a textual representation of the game board after each move as in

The rabbit is indicated with an r and the wolves with 1 and 2. If the wolves are on the same square, this is indicated with a 3. Finally, the > and < indicate that the x-dimension wraps, the rabbits and wolves can always move left or right.

The second board above shows that in the first round, the first wolf moved right, the second left (wrapping around the x-dimension), and finally the rabbit also moved left.

If the program is run 1000's of times, the number of moves required to catch the rabbit should drop: the wolves are learning.