Cutochess cli

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

Moderators: hgm, Rebel, chrisw

Krzysztof Grzelak
Posts: 1525
Joined: Tue Jul 15, 2014 12:47 pm

Cutochess cli

Post by Krzysztof Grzelak »

I would have a huge and heartfelt request. I've never had to deal with this application. I would like to learn for her to support this application. Maybe for the very beginning, I downloaded the application from the site https://rwbc-chess.de/download.htm . To understand the program and command played a short match between the two engines. These will be two sample engines - Komodo Dragon x64 and Stockfis 13 x64. I will use 6 man Syzygy and books in pgn format - 6 moves. I would like to configure the engines, so like this:

Komodo Dragon x64
Protocol=uci;
Hash=1024;
Threads=4;
Contempt=8;
Overhead ms=100;
SyzygyPath=D:/Syzygy;
Time Usage=0;
Table Memory=256;
Syzygy Probe Limit=6;
Syzygy Probe Depth=2;
Smart Syzygy=false;
OwnBook=false;
Ponder=false;

Stockfis 13 x64
Protocol=uci;
Hash=1024;
Threads=4;
SyzygyPath=D:/Syzygy;
Use NNUE=true;
Contempt=24;
Move Overhead=1000;
UCI_ShowWDL=true;
OwnBook=false;
Ponder=false;

The match will be played by the system " Round robin " - game time - 3 minits + 2 seconds, number of rounds - 10. I will use 6 man Syzygy and books in pgn format - 6 moves. I would like to save all games to my hard drive - "Save" file in png format. Thank you in advance to all those who will help me.
JohnS
Posts: 215
Joined: Sun Feb 24, 2008 2:08 am

Re: Cutochess cli

Post by JohnS »

Here is something to get you going, I didn't include all the uci options you want but you can add more once you have the basic setup working.

cutechess-cli ^
-engine cmd=c:\stockfish\stockfish proto=uci option.Threads=4 option.Hash=1024 ^
-engine cmd=c:\dragon\dragon proto=uci option.Threads=4 option.Hash=1024 ^
-each tc=40/3+2 ^
-openings file=c:\openings\book.pgn start=1 ^
-pgnout matchgames.pgn

save this as a batch file and run in command prompt in windows, you can change and add options as you want, also change the paths/names to the engines and file names.

By the way banksia is great for engine matches and is probably easier to use.
Last edited by JohnS on Tue Mar 09, 2021 2:11 am, edited 1 time in total.
Modern Times
Posts: 3550
Joined: Thu Jun 07, 2012 11:02 pm

Re: Cutochess cli

Post by Modern Times »

JohnS wrote: Tue Mar 09, 2021 2:03 am
By the way banksia is great for engine matches and is probably easier to use.
CuteChess GUI for that matter.
Krzysztof Grzelak
Posts: 1525
Joined: Tue Jul 15, 2014 12:47 pm

Re: Cutochess cli

Post by Krzysztof Grzelak »

Thank you very much for your response JonnS. Maybe banksia program is good, but it has a lot of errors. That's why I rejected him.
Krzysztof Grzelak
Posts: 1525
Joined: Tue Jul 15, 2014 12:47 pm

Re: Cutochess cli

Post by Krzysztof Grzelak »

I have a question. What is the difference between -tb PATHS and -tbpieces N.
Krzysztof Grzelak
Posts: 1525
Joined: Tue Jul 15, 2014 12:47 pm

Re: Cutochess cli

Post by Krzysztof Grzelak »

There are mistakes all the time. After saving -engine name="Stockfish 13 x64" cmd=c:\Cute\stockfish_13_win_x64_modern.exe proto=uci option.Threads=4 option.Hash=1024 option.SyzygyPath=D:/Syzygy option.Use NNUE=true option.Contempt=24 option.Move Overhead=1000 option.UCI ShowWDL=true option.OwnBook=false option.Ponder=false -engine name="DragonKomodo x64" cmd=c:\Cute\dragon-64bit.exe proto=uci option.Threads=4 option.Hash=1024 -each tc=60 -openings file=d:\Book\3M_rand.pgn -pgnout matchgames.pgn -rounds 4 -concurrency 1

The error shows up NNUE
Raphexon
Posts: 476
Joined: Sun Mar 17, 2019 12:00 pm
Full name: Henk Drost

Re: Cutochess cli

Post by Raphexon »

Krzysztof Grzelak wrote: Tue Mar 09, 2021 3:11 pm I have a question. What is the difference between -tb PATHS and -tbpieces N.
https://github.com/cutechess/cutechess/ ... p.txt#L101

Code: Select all

  -tb PATHS		Adjudicate games using Syzygy tablebases. PATHS should
			be semicolon-delimited list of paths to the compressed
			tablebase files. Only the WDL tablebase files are
			required.

Code: Select all

  -tbpieces N		Only use tablebase adjudication for positions with
			N pieces or less.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Cutochess cli

Post by Ferdy »

Krzysztof Grzelak wrote: Tue Mar 09, 2021 4:12 pm There are mistakes all the time. After saving -engine name="Stockfish 13 x64" cmd=c:\Cute\stockfish_13_win_x64_modern.exe proto=uci option.Threads=4 option.Hash=1024 option.SyzygyPath=D:/Syzygy option.Use NNUE=true option.Contempt=24 option.Move Overhead=1000 option.UCI ShowWDL=true option.OwnBook=false option.Ponder=false -engine name="DragonKomodo x64" cmd=c:\Cute\dragon-64bit.exe proto=uci option.Threads=4 option.Hash=1024 -each tc=60 -openings file=d:\Book\3M_rand.pgn -pgnout matchgames.pgn -rounds 4 -concurrency 1

The error shows up NNUE
If there is space in the option name, put it under double quotes.

Code: Select all

option."Use NNUE"=true
But that is not necessary as the default value is true already.


Can someone request the SF team to remove the space on option names.
Move Overhead
Slow Mover
Use NNUE
Skill Level
Debug Log
Krzysztof Grzelak
Posts: 1525
Joined: Tue Jul 15, 2014 12:47 pm

Re: Cutochess cli

Post by Krzysztof Grzelak »

Thank you so much Ferdy. I still have such a problem with the three options UCI_ShowWDL=true; OwnBook=false; Ponder=false;. The program writes that there are no such options in the engine Stockfish.
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: Cutochess cli

Post by MikeB »

I just use a bash shell script, it's easier for me, ymmv. This runs on msys2, other systems may need tweaking

The genesis for this was Bob Hyatt old match.exe and scripts we used to use to test Crafty. I just modified it here for the cutchess client.

I also have scripts that watch progress periodically and then report out. I use it to monitor testing when I'm not home .
You would comment in line 193 "start watcher.sh" and then you would need watch.sh and getelo.sh

Code: Select all

#!/bin/bash

### Copyright 2021 Michael F. Byrne, Robert M. Hyatt
### This program is free software: you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation, either version 3 of the License, or
### (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <https://www.gnu.org/licenses/>.

########### call scripts without "./" #######
######################## Call other scripts without "./" #######################
export PATH=$PATH:.
###############################################################################

############################## USER DEBUG OPTIONS ##############################
#set -x #verboose mode , useful for tracking down errors whe it does not run
#db=1
#echo $db # 0 = false, cutechess debug is  debug is off, 1 turns debug on, useful for debugging script
###############################################################################

################################################################################
#clear  #clears creen if desired
##  terminal screen countdown before,
##  if needed to pause while anotehr tourney complates
secs=-1
while [ $secs -gt -1 ]; do
##  terminal screen countdown before proceeding
  echo -ne "  ...seconds remaining before kickoff:   $secs\033[0K\r"
  ##  terminal screen countdown before proceeding
  sleep 1
  : $((secs--))
done
########### end loop
echo "Settings ..."; echo ""
################################################################################

#############################  Collect timing date  ##########################
DATE=$(shell date +"%m%d%H%M")
dat=`date +"%D"`
nowt=`date +"%T"`
echo "Current date : time (EDST)"
echo "Date: $dat : $nowt"
echo ""
et=0
startt=`date +%s`
export PATH=.:$PATH
###############################################################################

################################# Game Time Settings #####################################
base=60
incf=60
##  base/incf = inc, e.g. base 60 /60 = 1 sec inc ;
#   base 60 / 100 = .6 sec inc; base= 60/ 30 = 2 sec inc
# examples:
# base secs  /           20 20 20 20 20             60  60  60 60 60 60
# increment factor      100 50 40 20 10            120 100  60 30 20 10
# = inc secs             .2 .4 .5  1  2             .5  .6   1  2  3  6
################################################################################

################################## Rounds #####################################
rounds=50
# total num of games will be ( num of engines * (num of engines -1) * rounds
concur=50 ## num of concurrent games . threads * concur should ALWAYS be less than # of logical CPUS

############################### ENGINE Options ################################
hash="128"
threads="1"
multipv="4"

DIR="/c/cluster.mfb/Popcnt-LP"
SYZYGY="option.SyzygyPath=/c/syzygy"
SYZYGYSF="/c/syzygy"
# NN options
NNE="UseNN"
NNER="true" # or false
################################################################################

############################### NUMBER OF ENGINES #############################
#engine=( 1 2 3 4 5 6 7 )  ## I always forget to update otherwise
#engine=( 1 2 3 4 5 6 7 8 9 )
engine=( 1 2 )
engines=${#engine[@]}
echo $engines
################################################################################

######################### Various ENGINE & ID SETTINGS #########################

CMD1="Zappa_Mexico_II_x64.exe"
ENG1="Zappa_Mexico_II"



CMD2="stockfish-7.exe"
ENG2="Stockfish 7"






###############################################################################

############################### TOURNAMENT OPTIONS #############################
######################## Opening Files& Settings ###############################
format=epd ## pgn or epd, pgn is the default
#format=pgn
ofile="c:/cluster.mfb/Popcnt-LP/books/DRSullivan500.epd"
# 500 posiiton file with more balanced lines

#ofile="c:/cluster.mfb/Popcnt-LP/books/NBSC_30k_5mvs.epd"
# 30000 position file is very unbalance - favors white

#order="sequential"  # option -> sequential or random
order="random"
#START=1             # Used with 'sequential' order only, START is the number of the first opening that will be played. The minimum value for START is 1 (default).
PLY=8               # The opening depth is limited to PLIES plies. If PLIES not set the opening depth is unlimited.

tournament_type="round-robin"  # round-robin guantlet knockout pyramid

POLICY="round"      # options:
                    #    'default'- which shifts for any new pair of players and also when the number of  opening repetitions is reached.
                    #    'encounter'- which uses a new  opening for any new pair of players
                    #    'round'- which  shifts only for a new round, all engines play the same opening each round
#POLICY="default"
################################################################################

######################## DO NOT TOUCH - For Debug Purpose ######################
## Debug test - set at row 26
if [[ $db = 1 ]]
then
  DEBUG="-debug"
else
  DEBUG=""
fi
echo $DEBUG
################################################################################

####################  Number of Cutechess Runs Back-to-Bacl ####################
### "2" call cutechese twwice & doubles the games
cute_runs=2
################################################################################

################################### PGN File ###################################
#######Only change to manullay set pgn file ###
pgn="c:/cluster.mfb/pgn/$DATE.pgn";
#pgn="c:/cluster.mfb/pgn/0730xxxx.pgn"
echo "PGN File: $pgn"; #echo ""
################################################################################

########### DO NOT TOUCH - Hack to obtain fp decinmal from BASE #################
#  hack to use floating point(fp) in bash (bc not available/working in Git basb),
#  but it does screw up the Atom auto color, needed for calc of increment :
#  inc= base/100 or if base is 10 seconds , 10/100=0.1 etc.
inc=$(printf %.3f "$(((10**3 * base)/$incf))e-3"); #echo $inc
## "$(printf %.1f "$((()/1))e-1" ## hack to fix auto color in atom
################################################################################

################ DO NOT TOUCH - AUTO CALCULATED FROM ABOVE #####################
###### Used to calculate total games schedule and estimate total runtime ######
#engines=20
let engfact=($engines-1) ; #echo $engfact
let games=($rounds*$engines*$engfact*$cute_runs) ; echo "Games: $games"
let engchk=$engines
let checknum=($rounds*10)/$concur
let checknum=($checknum*$engchk)
let msInc=($base*1000*136)/$incf
let msBase=($base*1000)*2
let gmtime=($msBase+$msInc)/1000   ;#echo "gt "$gmtime
let ccrTime=$cute_runs*$gmtime
let ttime=($games*$gmtime)/$concur+25 #; echo $ttime
let ttime=($ttime*833)/1000+$ccrTime #;echo $ttime
#echo $ttime
secstime=$ttime

#convert seconds to hours and minutes
fc=$(printf 'Projected-> Time: %dh:%dm:%ds' $(($secstime/3600)) $(($secstime%3600/60)) $(($secstime%60)));
echo $fc ; #echo ""
elo_chk=($ttime/$checknum); #echo $elo_chk
TC="$base+$inc"
echo $TC
tcd="Time Control-> base+inc: $base+$inc"; echo ""
echo $tcd
################################################################################
let wat_wait=($elo_chk*2)
################ Pass variables to the other scripts ###########################
export checknum elo_chk engchk engines et fc games hash pgn secs startt tcd threads ttime wat_wait
################################################################################

# read # hack to stop processing here and keep window open,
# unhash, also unhash rows 42 and 42 - for debugging

########################### Start Watcher Script ##############################
start watcher.sh. ####
####/c/Users/MichaelB7/home/Github/cutechess/projects/cli/watcher.sh ## spawns off the watcher script which reports on progress on a periodic basis#
#read # hack used for testing - stops processing
#read
echo "Start running the chess match ..."

########### Manually Update#####################################################
# 1st cute chess run random book
# &> redirects ALL output to /dev/null , &>log.text to debug
################################################################################

################################################################################
########################## Alternative Random Setup ############################
ofile="c:/cluster.mfb/Popcnt-LP/books/DRSullivan500.epd"
#ofile="c:/cluster.mfb/Popcnt-LP/books/2moves_v2.pgn"

#ofile="c:/cluster.mfb/Popcnt-LP/books/Drawkiller_balanced_small500.epd"
# 500 posiiton file with more balanced lines
order="sequential"  # option -> sequential or random
#order="random"
#2nd pass with random book

cutechess-cli $DEBUG -repeat -rounds $rounds -games 2 -tournament $tournament_type  -tb c:/syzygy -tbpieces 6 -resign movecount=1 score=700 twosided=true -draw movenumber=40 movecount=10 score=2 -concurrency $concur -openings file=$ofile format=$format order=$order plies=$PLY policy=$POLICY  -pgnout $pgn -engine dir=$DIR name=$ENG1 cmd=$CMD1  -engine dir=$DIR name=$ENG2 cmd=$CMD2 -each tc=$TC proto=uci option.Threads=$threads option.Hash=$hash $SYZYGYl 2>/dev/nul
#read

# 2>/dev/nul

################################################################################
################################################################################

################################################################################
################ 3rd Pass-Sequential Setup with different book #################
# 500 posiiton file with more balanced lines
ofile="c:/cluster.mfb/Popcnt-LP/books/Drawkiller_balanced_small500.epd"
##ofile="c:/cluster.mfb/Popcnt-LP/books/2moves_v2.pgn"
#order="sequential"  # option -> sequential or random
#order="random"
#3rd pass with sequential book
#read
#$(run)
cutechess-cli $DEBUG -repeat -rounds $rounds -games 2 -tournament $tournament_type  -tb c:/syzygy -tbpieces 6 -resign movecount=1 score=700 twosided=true -draw movenumber=40 movecount=10 score=2 -concurrency $concur -openings file=$ofile format=$format order=$order plies=$PLY policy=$POLICY  -pgnout $pgn -engine dir=$DIR name=$ENG1 cmd=$CMD1  -engine dir=$DIR name=$ENG2 cmd=$CMD2 -each tc=$TC proto=uci option.Threads=$threads option.Hash=$hash $SYZYGYl 2>/dev/nul

################################################################################
################################################################################


################################### Wrap Up ####################################
################################ DO NOT TOUCH ##################################
end=`date +%s`
let endt=$end-$startt
echo ""
echo "#########################################################################################################"
echo "###                                              Summary                                              ###"
echo "#########################################################################################################"
echo ""
getelo.sh
echo ""
echo "#########################################################################################################"
echo "###                                                End                                                ###"
echo "#########################################################################################################"
echo ""
echo ""
echo " " >> c:/Users/MichaelB7/Dropbox/elo.txt
getelo.sh >> getelo.sh >> c:/Users/MichaelB7/Dropbox/elo.txt

################################################################################
################################################################################
#end
Image