CETSA (Chess Engine Tournament Script for Android)

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Archimedes
Posts: 135
Joined: Tue Mar 05, 2019 3:43 pm
Full name: Archimedes

CETSA (Chess Engine Tournament Script for Android)

Post by Archimedes »

Lately, i wrote a small script for better handling tournaments with c-chess-cli and Bayeselo on Android. It's moreover a working directory, containing all necessary files (start script, executables, opening files, configuration files and so on). Written and tested on Termux.

CETSA 2021.05.24:
https://app.box.com/s/wl5uu6nvmnw52g4ehztkxy3j652ob795

The following (very) short description assumes that you have already installed Termux and you are aware with basic linux stuff.

Download CETSA (Chess Engine Tournament Script for Android), start Termux and copy the tar archive to the home directory (change the command line for your needs).

Code: Select all

cp /storage/emulated/0/Download/cetsa_2021.05.24.tar.gz ./
Extract the tar archive.

Code: Select all

tar -xf ./cetsa_2021.05.24.tar.gz
Now you have a directory cetsa in your home directory. Go to the cetsa directory and start the script.

Code: Select all

cd ./cetsa
./start.sh
Start CETSA and let the script create a directory outside of Termux for you, the CETSA_HOME directory.

Now you can prepare and start a tournament in three simple steps now.

1. Copy the engines you want to test to /storage/emulated/0/CETSA/uci.

2. Edit /storage/emulated/0/CETSA/etc/c-chess-cli.conf (the parameters for c-chess-cli) and make the necessary changes.

Code: Select all

../bin/c-chess-cli/$CETSA_ABI/c-chess-cli -each \
  tc=10+0.1 \
  option.Hash=16 \
  option.Threads=1 \
  -engine cmd=../uci/Ethereal \
  -engine cmd=../uci/Fire \
  -games 1 \
  -concurrency 1 \
  -openings file=../epd/IM_4mvs.epd order=random \
  -repeat \
  -resign number=100 count=5 score=900 \
  -draw number=100 count=5 score=5 \
  -pgn games.pgn 1
As you can see, each engine has its own command line. About the meaning of the parameters of c-chess-cli, please read the documentation on the GitHub site at https://github.com/lucasart/c-chess-cli.

3. Start tournament.

Code: Select all

./start.sh
When finished, all generated files will be located in the log directory. The ratings from Bayeselo, the games in pgn format and some log files (if log is activated). Additionally, all these files will be copied outside the Termux folder to the CETSA_HOME directory (default: /storage/emulated/0/CETSA) for better file handling.

There are three environment variables used in the script. With CETSA_ABI you define, what device you are using (only necessary for finding the right executables for c-chess-cli and Bayeselo). With CETSA_HOME you define where the output files will be copied outside of Termux. This is optional and can be disabled (by disabling the CETSA_HOME environment variable). If CETSA_HOME is disabled, all things happens in Termux only. At least there is an environment variable called CETSA_SYNC. If activated (true) all the directories in the CETSA_HOME directory will be synchronized with the same folder in Termux. If disabled (false) all files in the directories will only be copied to the same folder in Termux (older files will not be deleted).

The cetsa directory on Termux contains the following directories:

bin: Contains the executables for c-chess-cli and Bayeselo.
epd: Contains the opening files used by c-chess-cli.
etc: Contains the configuration files for Bayeselo and c-chess-cli.
log: Contains the output files (rating, games and log files).
uci: Contains the chess engines.

Again, to prepare and start a tournament you only need three simple steps.

1. Copy engines to /storage/emulated/0/CETSA/uci.
2. Edit /storage/emulated/0/CETSA/etc/c-chess-cli.conf.
3. Start tournament.

Preparation of a tournament can completely done outside of Termux with your favorite Android tools (die to the presence of the CETSA_HOME directory). The only thing you have to do in Termux is, starting the tournament.
Ferdy
Posts: 4834
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: CETSA (Chess Engine Tournament Script for Android)

Post by Ferdy »

Thanks, it worked 8-)
Archimedes
Posts: 135
Joined: Tue Mar 05, 2019 3:43 pm
Full name: Archimedes

Re: CETSA (Chess Engine Tournament Script for Android)

Post by Archimedes »

CETSA 2021.05.27:
https://app.box.com/s/2bc35bgw8beagv3ptokampqqsd6duxh4

Now with a version number in the script. Added the wake lock feature from Termux (needs a permission when activated). Can be disabled (by disabling the CETSA_WAKE_LOCK environment variable) in the case it doesn't work for you or you want to use other possibilities to prepare Termux from sleeping when screen is off. If enabled (true), tournament is running in the background when screen is off. If disabled (false), tournament is pausing in the background when screen is off (this is a normal behavior on Android). Without the wake lock feature, you have to change some settings in Android for proper running a chess engine tournament in the background as you already know. :wink:
Ferdy
Posts: 4834
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: CETSA (Chess Engine Tournament Script for Android)

Post by Ferdy »

Archimedes wrote: Thu May 27, 2021 2:58 pm CETSA 2021.05.27:
https://app.box.com/s/2bc35bgw8beagv3ptokampqqsd6duxh4

Now with a version number in the script. Added the wake lock feature from Termux (needs a permission when activated). Can be disabled (by disabling the CETSA_WAKE_LOCK environment variable) in the case it doesn't work for you or you want to use other possibilities to prepare Termux from sleeping when screen is off. If enabled (true), tournament is running in the background when screen is off. If disabled (false), tournament is pausing in the background when screen is off (this is a normal behavior on Android). Without the wake lock feature, you have to change some settings in Android for proper running a chess engine tournament in the background as you already know. :wink:
So this is why I saw acquire wakelock / release wakelock in Termux. The previous app is already working when I acquire wakelock before running a match.
Archimedes
Posts: 135
Joined: Tue Mar 05, 2019 3:43 pm
Full name: Archimedes

Re: CETSA (Chess Engine Tournament Script for Android)

Post by Archimedes »

It's the same. When activated in the script it does it automatically for you (acquiring wakelock before and releasing wakelock after tournament).
Ferdy
Posts: 4834
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: CETSA (Chess Engine Tournament Script for Android)

Post by Ferdy »

Archimedes wrote: Fri May 28, 2021 10:00 am It's the same. When activated in the script it does it automatically for you (acquiring wakelock before and releasing wakelock after tournament).
I will try the new version since it can automatically activate/deactivate.
Archimedes
Posts: 135
Joined: Tue Mar 05, 2019 3:43 pm
Full name: Archimedes

Re: CETSA (Chess Engine Tournament Script for Android)

Post by Archimedes »

Log files are now archived in separate folders (naming scheme: "yymmdd_HHMMSS") when tournament is over (can be disabled by disabling the CETSA_ARCHIVE variable).

CETSA 2021.05.30:
https://app.box.com/s/3tyzpbbc6nh4zzbt9lebuvltv0chk6cw
Archimedes
Posts: 135
Joined: Tue Mar 05, 2019 3:43 pm
Full name: Archimedes

Re: CETSA (Chess Engine Tournament Script for Android)

Post by Archimedes »

Small Update. When a tournament is finished, you will see statistic information about the tournament (e. g. number of time forfeits). An additional file c-chess-cli.txt will be created in the log directory with this information.

c-chess-cli.txt:

Code: Select all

3-fold repetition: 16
50 moves rule: 1
Adjudication: 0
Checkmate: 78
Insufficient material: 4
Stalemate: 1
Time forfeit: 0
CETSA 2021.06.11:
https://app.box.com/s/36kl865d97d8at1t4ihg5phka2rfh2rd
Archimedes
Posts: 135
Joined: Tue Mar 05, 2019 3:43 pm
Full name: Archimedes

Re: CETSA (Chess Engine Tournament Script for Android)

Post by Archimedes »

Statistic information was not complete. Through c-chess-cli there are two more termination reasons possible ("rules infraction" and "unterminated"). I also included the new version of c-chess-cli.

CETSA 2021.06.12:
https://app.box.com/s/g3bifsza5ykvwhye2mvnsoh2i818xb1m