Cutochess cli

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

Moderator: Ras

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

Re: Cutochess cli

Post by Krzysztof Grzelak »

Thank you again Ferdy. having trouble with a certain engine. It shows an error every time. The engine is Equinox 3.30-x64
Krzysztof Grzelak
Posts: 1585
Joined: Tue Jul 15, 2014 12:47 pm

Re: Cutochess cli

Post by Krzysztof Grzelak »

One of the better GUIs I've ever seen.I already advised myself with the engine Equinox 3.30-x64. Ferdy I have a request for you. Write how you know what in the save game such things mean as {d=6, sd=16, mt=1459, tl=28641, s=1630, n=2358,tb=0, h=0.0, ph=0.0, wv=0.12, R50=49, Rd=-13, Rr=-9, mb=-1+0+0+0+0,}
Krzysztof Grzelak
Posts: 1585
Joined: Tue Jul 15, 2014 12:47 pm

Re: Cutochess cli

Post by Krzysztof Grzelak »

MikeB wrote: Tue Mar 09, 2021 6:50 pm 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
Then please share this script.
cpeters
Posts: 186
Joined: Wed Feb 17, 2021 7:44 pm
Full name: Christian Petersen

Re: Cutochess cli

Post by cpeters »

Hello Krysztof!


You're looking at it.
Krzysztof Grzelak
Posts: 1585
Joined: Tue Jul 15, 2014 12:47 pm

Re: Cutochess cli

Post by Krzysztof Grzelak »

cpeters wrote: Thu Mar 11, 2021 7:07 pm Hello Krysztof!


You're looking at it.
Warmly I apologise that I am asking, because not much I don't understand.
Ferdy
Posts: 4850
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Cutochess cli

Post by Ferdy »

Krzysztof Grzelak wrote: Thu Mar 11, 2021 8:43 am One of the better GUIs I've ever seen.I already advised myself with the engine Equinox 3.30-x64. Ferdy I have a request for you. Write how you know what in the save game such things mean as {d=6, sd=16, mt=1459, tl=28641, s=1630, n=2358,tb=0, h=0.0, ph=0.0, wv=0.12, R50=49, Rd=-13, Rr=-9, mb=-1+0+0+0+0,}
d is depth
sd is seldepth
mt is movetime
tl is timeleft
s is nps or nodes/sec
n is nodes
tb is tbhits
h, I don't know
ph, I don't know
wv is score in pawn unit from white's point of view or wpov score

The rest I don't know.
Krzysztof Grzelak
Posts: 1585
Joined: Tue Jul 15, 2014 12:47 pm

Re: Cutochess cli

Post by Krzysztof Grzelak »

Thank you very much Ferdy.
JohnW
Posts: 402
Joined: Thu Nov 22, 2012 12:20 am
Location: New Hampshire

Re: Cutochess cli

Post by JohnW »

It's too bad someone doesn't create a gui that exposes an api to automate it similar to what you can do with Microsoft Excel or Microsoft Word.
Then we can could use the gui to install and configure the engines and if we wanted to automate the gui from our own application we could.
bastiball
Posts: 5360
Joined: Tue Oct 20, 2020 4:18 am
Full name: Basti Dangca

Re: Cutechess cli Doesn't run

Post by bastiball »

Cutechess cli for windows doesn't run on me but the GUI does run. I dunno what is the problem.
Basti Dangca
CCRL testing group
JohnW
Posts: 402
Joined: Thu Nov 22, 2012 12:20 am
Location: New Hampshire

Re: Cutechess cli Doesn't run

Post by JohnW »

bastiball wrote: Sun Mar 14, 2021 5:45 pm Cutechess cli for windows doesn't run on me but the GUI does run. I dunno what is the problem.
I am trying to create an application that automatically creates random matches between engines and works like a screensaver when my computer is idle. So an api to the gui would make it much easier to define all their parameters.

cutechess cli works correctly for me but it's a pain to set all the parameters for each engine especially when there is no standards. For example most engines have a "Threads" parameter but an engine like Rybka 3 calls it "Max CPUs" and it's case sensitive for some reason. Engines like the Komodo has numerous parameters and if you have many versions it takes a long time to do.