Try out lichess' bot interface https://lichess.org/api#tag/Chess-Bot
- Get an API token from lichess.org.
$ nvm use v10.15.3
$ yarn install
# Linux
$ export API_TOKEN=xxxxxxxxxx
# Windows
$ setx API_TOKEN xxxxxxxxxx
$ yarn test
$ yarn start
To implement your chess bot you only need to create one class that implements the method:
getNextMove(moves) {
return uciMove;
}
Where moves is a list of moves so far in uci format e.g. ["e2e4", "b8c6", "f2f4"]
See RandomPlayer
for minimal implementation using chess.js
If you register a free heroku account you can host a BOT like this one as is - just add your API_TOKEN
to the environment property configuration.
This code auto deploys and is live at https://test-o-a.herokuapp.com/
You do not need to own a server to host a BOT, this code also runs in a browser. Watch how a BOT communicates with the server https://tailuge.github.io/bot-o-tron/dist/testBot.html
Compare bots locally - and the winner of the 8 x round-robin tournament is...
$ yarn tournament
Results
[ { player: 'AntiPatzerPlayer ', score: 32.5 },
{ player: 'PatzerPlayer ', score: 23 },
{ player: 'RandomPlayer ', score: 22.5 },
{ player: 'SwarmKingPlayer ', score: 18 } ]