A simple library for communicating with the Albot.Online client.
This is great for getting you up and running fast, allowing you to focus more on the AI logic.
This library is available as jars (library + javadoc). Download them from the target folder of this repository.
When the jars are downloaded, import them to your project. Preferably by using a sophisticated IDE such as IntelliJ: How to add Jar to Dependencies in IntelliJ.
Following is a short example of the Java Library being put to use on the Snake game. For exact information of how to use the library see the documentation Wiki.
import albot.Constants;
import albot.snake.*;
import java.util.List;
import java.util.Random;
public class Main {
public static void main(String[] args) {
SnakeGame game = new SnakeGame(); // Connects you to the client
Random rand = new Random();
while(game.awaitNextGameState() == BoardState.ongoing) { // Gets/Updates the board
// Since this gives a class containing both playerMoves and enemyMoves, we specify playerMoves
List<String> possibleMoves = game.getPossibleMoves(game.currentBoard).playerMoves;
int randomIndex = rand.nextInt(possibleMoves.size());
String randomMove = possibleMoves.get(randomIndex);
game.makeMove(randomMove);
}
}
}
This bot will simply connect to the client, look at what moves it currently has available and pick one at random.
0.63
Joey Öhman
This project is licensed under the MIT License - see the LICENSE.md file for details