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
+----+ <3...> <....> <...r> +----+ +----+ <.1.2> <....> <..r.> +----+ ...
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.