Git Product home page Git Product logo

albot-java-library's Introduction

Albot.Online Java Library

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.

Getting Started

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.

Example

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.

Versioning

0.63

Authors

Joey Öhman

License

This project is licensed under the MIT License - see the LICENSE.md file for details

albot-java-library's People

Contributors

joeyohman avatar torbacka avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.