Giter VIP home page Giter VIP logo

java-socket-stockfish's Introduction

license FAQ

Stockfish Java

Stockfish Java is an open source asynchronous high level wrapper for the popular uci chess engine Stockfish 10

Quick Start

To start, create a Stockfish Client instance:

StockfishClient client = new StockfishClient.Builder()
        .setInstances(4)
        .setVariant(Variant.BMI2)
        .build();

This library allows multiple Stockfish instances to run concurrently to lessen the impact of thread blocking chess computation. By default, the client only creates one instance, but we can override that by setting the number in the builder. There are also multiple variants of Stockfish. In the builder, we can specify BMI2, POPCNT (Windows only), or MODERN (Linux only). A general rule of thumb is to go with BMI2 first and if it crashes or is incompatible with your system, use POPCNT/MODERN depending on your operating system. If variant is not set in the builder, we default to the regular Stockfish binary.

After creating the client, we can define a query for the client to compute:

Query query = new Query.Builder(QueryType.Legal_Moves)
        .setFen("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")
        .build();

More on queries can be found in the wiki, but for now we're just going to submit the query to the client:

client.submit(query, result -> {
    // Do something with the result
})

Using a callback, we grab the result and can use it with a lambda.

The included tester shows some more example usage of the Stockfish Java library.

Documentation

Information regarding Stockfish Java as well as full usage of the client is detailed in the wiki. As this is a constantly evolving project, the wiki will receive frequent updates and will have the most up to date documentation.

Contributors

Owners and Developers

Other Contributors

  • This could be you :)

Dependencies

java-socket-stockfish's People

Contributors

finaldayz avatar

Watchers

James Cloos 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.