Engine match with python script

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

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
Fulvio
Posts: 194
Joined: Fri Aug 12, 2016 6:43 pm

Engine match with python script

Post by Fulvio » Tue Feb 18, 2020 11:03 am

Hi,
does exist a python script/program to let 2 engines play against each other and which creates the annotated pgn?
Something like cutechess-cli, but written in python.
Thanks

User avatar
xr_a_y
Posts: 1116
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: Engine match with python script

Post by xr_a_y » Tue Feb 18, 2020 11:23 am

Can't you just call cutechess inside a python script ?

User avatar
gbtami
Posts: 377
Joined: Wed Sep 26, 2012 11:29 am
Location: Hungary
Contact:

Re: Engine match with python script

Post by gbtami » Tue Feb 18, 2020 11:46 pm


Fulvio
Posts: 194
Joined: Fri Aug 12, 2016 6:43 pm

Re: Engine match with python script

Post by Fulvio » Wed Feb 19, 2020 3:20 pm

gbtami wrote:
Tue Feb 18, 2020 11:46 pm
See zinc viewtopic.php?f=7&t=60504&hilit=zinc
Thanks!
It doesn't work, but I suppose it is because it needs an older version of python-chess

Ferdy
Posts: 4235
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Engine match with python script

Post by Ferdy » Wed Feb 26, 2020 1:01 am

Fulvio wrote:
Tue Feb 18, 2020 11:03 am
Hi,
does exist a python script/program to let 2 engines play against each other and which creates the annotated pgn?
Something like cutechess-cli, but written in python.
Thanks
Just uploaded a basic script at https://github.com/fsmosca/combat
There are some limitations such as no support for pgn file as start position, only epd file is supported so far. See limitations section in the readme. It uses the python-chess modules.

Sample game output.


Fulvio
Posts: 194
Joined: Fri Aug 12, 2016 6:43 pm

Re: Engine match with python script

Post by Fulvio » Tue Mar 03, 2020 9:19 am

Ferdy wrote:
Wed Feb 26, 2020 1:01 am
Just uploaded a basic script at https://github.com/fsmosca/combat
There are some limitations such as no support for pgn file as start position, only epd file is supported so far. See limitations section in the readme.
Thank you!
Ferdy wrote:
Wed Feb 26, 2020 1:01 am
It uses the python-chess modules.
I think you should add a requirements.txt file with the python-chess version.

Another suggestion may be to add a match.json file instead of all the command line options.

Anyway: thanks again!

Ferdy
Posts: 4235
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Engine match with python script

Post by Ferdy » Wed Mar 04, 2020 12:16 am

Fulvio wrote:
Tue Mar 03, 2020 9:19 am
Ferdy wrote:
Wed Feb 26, 2020 1:01 am
Just uploaded a basic script at https://github.com/fsmosca/combat
There are some limitations such as no support for pgn file as start position, only epd file is supported so far. See limitations section in the readme.
Thank you!
Ferdy wrote:
Wed Feb 26, 2020 1:01 am
It uses the python-chess modules.
I think you should add a requirements.txt file with the python-chess version.

Another suggestion may be to add a match.json file instead of all the command line options.

Anyway: thanks again!
Added requirements.txt, and also match.ini.

match.ini

Code: Select all

[COMBAT]
# Engine settings file
engine config file = combat.json

# Games = rounds x 2 if reverse is true
round = 8
reverse = true

# Opening file and random
opening file = grand_swiss_2019_6plies.pgn
randomize position = true

# Adjudication
win adjudication enable = true
win adjudication score = 700
win adjudication count = 4

# Run game matches in parallel
parallel = 4


[ENGINE1]
# name is from engine config file or combat.json or engines.json
name = Deuterium v2019.2

# tc or time control as base_time+inc_time, all in ms
tc = 10000+100


[ENGINE2]
name = Deuterium v2019.2 mobility130
tc = 10000+100
To run with match.ini, just execute the script without options as in:
python combat.py

Post Reply