lichess.org
Donate

Hyper Bot - new ideas for bot development

Hyper Bot is

- barebone minimal ( * )
- native
- cloud hosted
- no need for any local installation ( ** )

* single file, without any complicated dependencies

** cloning and push is organized entirely online ( using forking and account linking ), if you insist on local installation, this still can be done online, using gitpod terminal ( also allows editing, local testing and pushing changes )

this is a product of my new thinking which targets moving development entirely online

source: github.com/hyperchessbot/hyperbot

online: hyperchessbot.herokuapp.com/

account: @chesshyperbot
communicating the bot state:

of course you could open the Heroku logs and watch that, but this is a bit cumbersome, after all the bot lives in a web server, so why not use this web page to communicate the log

there are three basic ways to stream a state, short polling, socket and event source ( which is kind of long polling )

short polling ( querying the state using get requests ) is problematic, because it may overload the server and the server cannot notify the page that the state has changed

sockets can get complicated ( especially on the server side )

I think event source is the simplest, it has a nice web API built in the browser, on the server side it is simple to implement, no need for separate socket server

the log you can view opening your browser's inspection tool

https://imgur.com/EwgI27o

however the most useful part, namely engine eval, is directly shown on the page, so that you don't need to open anything special to follow eval

https://imgur.com/XDr3UpX

you can try this for yourself by visiting hyperchessbot.herokuapp.com/ and challenging the bot at @chesshyperbot
Gitpod:

Gitpod is a relatively new tool, the idea is to open a git repo in a VS Code like IDE with a unix like terminal, within the browser

I discovered it when I tried to create a web page apart from the main project that needed frequent updates, and I did not want to mess the main project with such commits, for editing I used GitHub's editor, but this is very basic, so after I while I started looking for some better online editor, and it turned out that there is this full blown solution, namely Gitpod

opening a repo in Gitpod takes prefixing the repo's url with "gitpod.io/#" then visiting this link

by linking your GitHub account, you can also use it to push changes

it is better than a desktop IDE in several ways, first you don't need any installation, second, it fires up more quickly than a native IDE ( how is this possible? I guess what makes it easier is that the browser's user interface is already there, so you have done much of the firing up by opening your browser )

here is how the project looks in Gitpod ( gitpod.io/#https://github.com/hyperchessbot/hyperbot ):

https://imgur.com/DwUhVnB
installing your own bot:

first you need to login to your GitHub account ( sign up to GitHub if you have not already ) to fork the repo by visiting github.com/hyperchessbot/hyperbot and pressing the Fork button, which is on the top right hand side

https://imgur.com/KZIpHoE

next visit your Heroku account ( again sign up to Heroku if you have not already ), create a new app

https://imgur.com/BLu1dYr

open your new app's dashboard and go to the Deploy tab and press the GitHub button, to link your account

you need some clicking around, first enable GitHub, then search for repos and select your newly forked repo, finally press Enable Automatic Deploys, so that later changes will a trigger a build, and for the first deploy, press Deploy Branch ( you need to deploy the master branch, but this should be selected for you, as the project currently has only a master branch )

https://imgur.com/iEj3RKW

finally create and API token with your lichess bot account in Preferences / API access tokens with the following permissions

https://imgur.com/zdBeODh

in Heroku's Settings / Reveal config vars, create a variable TOKEN and copy the newly created bot token as its value and also create a variable BOT_NAME, and fill in your bot's username

after all this was done, you have an up and running lichess bot

note:

if creating a lichess bot account is a problem for you, just use an account that has not played any game ( or create a fresh account ), then visit easychess.herokuapp.com and follow the instructions in the LOGIN section
@zzhangb4 , thanks for the emots and for your pull request fixing the typo, I was aware of it, but only corrected it on the web page and forgot about the ReadMe ( for lazyness I use the page html for the ReadMe, and I have to copy it manually from the source, which I failed to do in this case )
sorry about bringing this thread up again, but I arrived at a new idea with regard to pondering

pondering should be shifted entirely to the engine and be made its second nature

I mean the client should not concern itself with pondering at all, it should only request in the go command with a flag argument, that after thinking up the move, the engine should be left pondering on the ponder move if any

of course this carries the risk that the engine remains in a pondering mode ( for example due to an abandoned game ) and next time it receives a position from an entirely different game while pondering on the original game, however the engine stores the whole move sequence on which it pondered, and compares this to the newly received one, and if they don't match, and they certainly won't if the new game is different, then this seems to it to be just an other pondermiss, in which case the pondering search is always stopped and a new search is started

so once you have the right engine, you just issue the same command as you would normally, without worrying about stopping the engine first, the only difference being this little flag that you send among the arguments

getting everything right is difficult in practice, but this gist shows a minimal working pondering uci engine module, good enough for powering a bot:

gist.github.com/hyperbotauthor/dd7544502c3f44988d26fd0954504626

set ALLOW_PONDER env var to "true" if you want your bot to ponder
if you set env var USE_BOOK to "true", the bot will use lichess opening explorer ( namely random weighted top 4 moves from >= 2200 rated games, blitz and rapid time controls, up to move 10 of the game )

this way the bot will play more human openings, still the selection criteria ensure that these moves will be also objectively strong, so they can be played against bots as well
@Mate_On_f7 ,

no, it is different, Hyper Bot is a cloud hosted native app, while ezchess runs in the browser

Hyper Bot in exchange for some hardship of installation gives you complete freedom to use native engines and cloud hosting means that you don't need to keep a page open in your browser for your bot to work

actually Stockfish12 NNUE (*), which comes with Hyper Bot installation, has no WebAssembly version, so ezchess cannot run Stockfish12 ( in fact it is rare for major engines to have a WebAssembly port )

* NNUE = Efficiently Updatable Neural Network ( letters of abbreviation are in reverse order )
Always make sure you updated your repo to the latest bot version.

For the update you need to open your repo in a Gitpod terminal.

Either prefix the url of your repo with `gitpod.io/#` and visit the resulting link ( example shows the link for user 'kingisawesome' ):

gitpod.io/#https://github.com/kingisawesome/hyperbot

or install the Gitpod browser extension and when your repo is opened in your browser window, click on the Gitpod button among your extensions:

www.gitpod.io/docs/browser-extension/

Fot the first time you have to enable Gitpod with your GitHub account.

Once you opened your repo, click the the top right user logo in your Gitpod IDE, from the menu select `Access control` and enable `write public repos`.

https://i.imgur.com/8aZ7fLa.png

Then in the bottom unix like terminal type:

git pull upstream master

when the changes were updated, type

git push

Now your repo should be up to date. If you enabled auto deploys in Heroku's deploy section, then your bot also should be up to date and running.

https://i.imgur.com/vyQVoeH.png

This topic has been archived and can no longer be replied to.