tailuge / bot-o-tron

Try out lichess' bot interface
https://bot-o-tron.onrender.com/
GNU General Public License v3.0
39 stars 24 forks source link

First Steps Questions #6

Open WolfgangFahl opened 4 years ago

WolfgangFahl commented 4 years ago

On my Mac with MacOS 10.13.6 and macports it did the following steps

git clone https://github.com/tailuge/bot-o-tron
cd bot-o-tron
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
# relogin since bash profile is changed ...
nvm install v10.15.3
npm install -g yarn
npm i -D nyc
yarn install
export API_TOKEN=xxxxxxxxxx
yarn test

which is a bit more than described in your readme. The tests ran fine and yarn start seems to do something sensible. The last line is

Wake up server listening on 5000

Where to go from here? How is a Javascript bot now integrated?

tailuge commented 4 years ago

on lichess you need to make a bot account https://lichess.org/api#operation/botAccountUpgrade

| * Token can be created on BOT accounts at https://lichess.org/account/oauth/token/create |

Put that token in your environment with  export API_TOKEN=xxxxxxxxxx Then your local javascript program can connect to lichess and you should be able to challenge it to a game in lichess.

On Saturday, 21 December 2019, 08:28:22 GMT, Wolfgang Fahl <notifications@github.com> wrote:  

git clone https://github.com/tailuge/bot-o-tron cd bot-o-tron On my Mac with MacOS 10.13.6 and macports it did the following steps curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

relogin since bash profile is changed ...

nvm install v10.15.3 npm install -g yarn npm i -D nyc yarn install export API_TOKEN=xxxxxxxxxx yarn test

which is a bit more than described in your readme. The tests ran fine and yarn start seems to do something sensible. The last line is

Wake up server listening on 5000

Where to go from here? How is a Javascript bot now integrated?

— You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

WolfgangFahl commented 4 years ago

Thank you for your swift response. I already had a bot account and didn't know how to proceed. By chance i saw that there were some entries like:

STREAM data : {"type":"gameStart","game":{"id":"FitklaCe"}}
GET api/bot/game/stream/FitklaCe stream
STREAM data : {"id":"FitklaCe","variant":{"key":"standard","name":"Standard","short":"Std"},"clock":null,"speed":"correspondence","perf":{"name":"Correspondence"},"rated":false,"createdAt":1576917061855,"white":{"id":"seppl2019","name":"seppl2019","title":"BOT","rating":1500,"provisional":true},"black":{"aiLevel":1},"initialFen":"startpos","type":"gameFull","state":{"type":"gameState","moves":"","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false}}
seppl2019 as white to move f2f3
POST api/bot/game/FitklaCe/move/f2f3 {}
{"ok":true}
STREAM data : {"type":"gameState","moves":"f2f3","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false}
STREAM data : {"type":"gameState","moves":"f2f3 e7e5","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false}
seppl2019 as white to move g2g4
POST api/bot/game/FitklaCe/move/g2g4 {}
{"ok":true}
STREAM data : {"type":"gameState","moves":"f2f3 e7e5 g2g4","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false}
STREAM data : {"type":"gameState","moves":"f2f3 e7e5 g2g4 d8h4","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false}

I still do not understand what to do next to integrate my own software. See https://github.com/WolfgangFahl/play-chess-with-a-webcam/issues/17

tailuge commented 4 years ago

Are you able to challenge it to a game on lichess logged in with your human account? When you play the moves in lichess you will see this kind of output which shows you the moves played by the opponent and the move the bot wants to play. 

On Saturday, 21 December 2019, 09:05:42 GMT, Wolfgang Fahl <notifications@github.com> wrote:  

I already had a bot account and didn't know how to proceed. By chance i saw that there were some entries like: STREAM data : {"type":"gameStart","game":{"id":"FitklaCe"}} GET api/bot/game/stream/FitklaCe stream STREAM data : {"id":"FitklaCe","variant":{"key":"standard","name":"Standard","short":"Std"},"clock":null,"speed":"correspondence","perf":{"name":"Correspondence"},"rated":false,"createdAt":1576917061855,"white":{"id":"seppl2019","name":"seppl2019","title":"BOT","rating":1500,"provisional":true},"black":{"aiLevel":1},"initialFen":"startpos","type":"gameFull","state":{"type":"gameState","moves":"","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false}} seppl2019 as white to move f2f3 POST api/bot/game/FitklaCe/move/f2f3 {} {"ok":true} STREAM data : {"type":"gameState","moves":"f2f3","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false} STREAM data : {"type":"gameState","moves":"f2f3 e7e5","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false} seppl2019 as white to move g2g4 POST api/bot/game/FitklaCe/move/g2g4 {} {"ok":true} STREAM data : {"type":"gameState","moves":"f2f3 e7e5 g2g4","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false} STREAM data : {"type":"gameState","moves":"f2f3 e7e5 g2g4 d8h4","wtime":2147483647,"btime":2147483647,"winc":0,"binc":0,"bdraw":false,"wdraw":false}

I still do not understand what to do next to integrate my own software. See WolfgangFahl/play-chess-with-a-webcam#17

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or unsubscribe.

WolfgangFahl commented 4 years ago

Are you able to challenge it to a game on lichess logged in with your human account? Yes When you play the moves in lichess you will see this kind of output which shows you the moves >played by the opponent and the move the bot wants to play. My use case is a bit different - i want to play with two human players and only record the game. Do I need two bot accounts for that or would one do?

Also I still don't see what I need to do to modify the behavior of the bot. Is there already a preconfigured chess bot active?

_To implement your chess bot you only need to create one class that implements the method:__

Where and how do i do that? How is this class integrated?

WolfgangFahl commented 4 years ago

I see there are 4 bots in the bots directory. How is the active bot selected?

tailuge commented 4 years ago

by default your javascript is using this code to act as the bot: https://github.com/tailuge/bot-o-tron/blob/master/src/bots/PatzerPlayer.js

it is called with the moves so far in the game and you have to return the next move you wish to play.

Modify that file is what you have to do.

On Saturday, 21 December 2019, 09:23:43 GMT, Wolfgang Fahl <notifications@github.com> wrote:  

Are you able to challenge it to a game on lichess logged in with your human account? Yes When you play the moves in lichess you will see this kind of output which shows you the moves >played by the opponent and the move the bot wants to play. My use case is a bit different - i want to play with two human players and only record the game. Do I need two bot accounts for that or would one do?

Also I still don't see what I need to do to modify the behavior of the bot. Is there already a preconfigured chess bot active?

To implement your chess bot you only need to create one class that implements the method:_

Where and how do i do that? How is this class integrated?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or unsubscribe.

WolfgangFahl commented 4 years ago

So I am reverse engineering this by looking at the source code ... it would be great if the readme would state a bit about these assumptions:

  links += await startBot(process.env.API_TOKEN, new PatzerPlayer());
  links += await startBot(process.env.API_TOKEN_SWARM, new AntiPatzerPlayer());

So indeed there might be wo tokens and two bots involved ...

tailuge commented 4 years ago

that right just stick to the PatzerPlayer and go from there

On Saturday, 21 December 2019, 09:31:11 GMT, Wolfgang Fahl <notifications@github.com> wrote:  

So I am reverse engineering this by looking at the source code ... it would be great if the readme would state a bit about these assumptions: links += await startBot(process.env.API_TOKEN, new PatzerPlayer()); links += await startBot(process.env.API_TOKEN_SWARM, new AntiPatzerPlayer());

So indeed there might be wo tokens and two bots involved ...

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or unsubscribe.

WolfgangFahl commented 4 years ago

Since my server is in python i'll first use https://github.com/rhgrant10/berserk to get aquainted with the API as such and may be get back later to this javascript library. Thanks for the help!