The code template to make a Lishogi Bot and deploy it to heroku server easily. This is the code of @libot and similar heroku run bots in lishogi.org
Engine communication code taken from https://github.com/TheYoBots/Lishogi-Bot by TheYoBots
heroku-20
(allowing a maximum hash size of 512 mb)
- Fork this repository.
- Edit only your token in the
config.yml
file over here. - Create a new heroku app.
- Go to the
Deploy
tab and clickConnect to GitHub
. - Click on
search
and then select your fork of this repository. - Then
Enable Automatic Deploys
and then select themain
branch (which is already done by default usually) and ClickDeploy
. - Once it has been deployed, go to
Resources
tab on heroku and enableworker (bash startbot.sh)
dynos. (Do note that if you don't see any dynos in theResources
tab, then you must wait for about 5 minutes and then refresh your heroku page.)
You're now connected to lishogi and awaiting challenges! Your bot is up and ready!
- This code might result in many crashes, so if any error shows up in the logs, immediately restart all dynos by clucking on
more
in the top right corner of your heroku app and then clickrestart all dynos
. Also do create an issue with your error logs if it has not already been discussed in another issue. - Do note that on heroku you are allowed a maximum of 550 hours a month, so you can't run your bot 24/7 unless you have a verified account. To get a verified account you will need to provide your payment details, but no payment is required. Once this is done, your account becomes verified and you are provided an additional 450 hours a month which sums up to a total of 1000 hours a month which is more than what is needed to run your bot 24/7 on lishogi.
- This bot uses
256 MB hash size
with10 threads
(stack:heroku-20
). This is quite strong. Heroku's free dyno's limitations are crossed even with 2-3 games in one go. So make sure you don't play many games in one go. If you want multiple games at a time, reduce the values of threads and hash in theconfig.yml
file and use multithreading to handle multiple games. This is mainly caused due to rate limiting from heroku. This can be prevented by decreasing the hash and threads in theconfig.yml
file. - When changing engines make sure you rename your engine name in the
startbot.sh
file, line 2 withchmod a+x engines/engine-name
, whereengine-name
must be replaced with the name of your engine. If your engine name is the same after changing your engine, this doesn't need to be done. Also do note forgot to change the engine name in the config.yml file too, wherename: "fairy-stockfish"
must be changed toname: "engine-name"
, where `engine-name is the name of your engine. All engines must be placed in the engines folder.