Disservin / fast-chess

fast-chess is a command-line tool to run engine vs engine matches in chess.
MIT License
71 stars 19 forks source link

parsing options #528

Closed vondele closed 2 weeks ago

vondele commented 2 weeks ago

fishtest sends this option to cutechess-cli / fast-chess:

./fast-chess    -recover -repeat -games 466 -tournament gauntlet\
                -pgnout results-a181cd67-43a0-4d6e-b6b4-98f9b5fa7e7e.pgn\
                -site 'https://tests.stockfishchess.org/tests/view/66872b0ffe7b81f5e163473c' -event 'Batch 295: master vs master'\
                -srand $RANDOM  -resign movecount=3 score=600 -draw movenumber=34 movecount=8 score=20\
                -variant standard -concurrency 4 -openings file=UHO_Lichess_4852_v1.epd format=epd order=random plies=16 start=52569\
                -engine name=New-ee6fc7e38b4aeef44862159215a56d97122f59a0 tc=0.539+0.005 cmd=./stockfish_ee6fc7e38b4aeef44862159215a56d97122f59a0 dir=.\
                        option.Hash=16 option.EvalFile=nn-ddcfb9224cdb.nnue option.EvalFileSmall=nn-37f18f62d772.nnue\
                -engine name=Base-ee6fc7e38b4aeef44862159215a56d97122f59a0 tc=0.539+0.005 cmd=./stockfish_ee6fc7e38b4aeef44862159215a56d97122f59a0 dir=.\
                        option.Hash=16 option.EvalFile=nn-ddcfb9224cdb.nnue option.EvalFileSmall=nn-37f18f62d772.nnue\
                -each proto=uci option.Threads=1 

works with cutechess, but fast-chess has:

terminate called after throwing an instance of 'std::runtime_error'
  what():  
Error while reading option "-engine" with value "option.EvalFileSmall=nn-37f18f62d772.nnue"
Reason: Error; Engine not found: 
gahtan-syarif commented 2 weeks ago

maybe because of the dash in the filename?

gahtan-syarif commented 2 weeks ago

or on second thought its probably the dot

        // Strip option.Name of the option. Part
        const std::size_t pos         = key.find('.');
        const std::string strippedKey = key.substr(pos + 1);
vondele commented 2 weeks ago

std::find_first_of ?

gahtan-syarif commented 2 weeks ago

wait, weirdly enough it works for me:

fast-chess.exe -openings file=C:\cutechess-1.3.1-win64\books\UHO_Lichess_4852_v1.epd -engine cmd="Stockfish dev-20240706-4d6e1225.exe" name=Engine1 -engine cmd="Stockfish dev-20240706-4d6e1225.exe" name=Engine2 option.EvalFile=nn-ddcfb9224cdb.nnue option.EvalFileSmall=nn-37f18f62d772.nnue -each proto=uci tc=10+0.1 dir="C:/Chess Engines/" -rounds 4 -concurrency 4 -resign movecount=3 score=600 -pgnout file=fastchess.pgn -ratinginterval 1 -log file=log -randomseed -sprt elo0=0 elo1=5 alpha=0.05 beta=0.05 model=normalized -recover
Initialized valid SPRT configuration.
Starting tournament...
Started game 3 of 8 (Engine1 vs Engine2)
Started game 2 of 8 (Engine1 vs Engine2)
Started game 1 of 8 (Engine2 vs Engine1)
Started game 4 of 8 (Engine2 vs Engine1)
Finished game 1 (Engine2 vs Engine1): 1-0 {Engine2 wins by adjudication}
Started game 5 of 8 (Engine1 vs Engine2)
Finished game 3 (Engine1 vs Engine2): 1-0 {Engine1 wins by adjudication}
Started game 6 of 8 (Engine2 vs Engine1)
Finished game 4 (Engine2 vs Engine1): 1-0 {Engine2 wins by adjudication}
--------------------------------------------------
Results of Engine1 vs Engine2 (10+0.1, 1t, 16MB, UHO_Lichess_4852_v1.epd):
Elo: -0.00 +/- 0.00, nElo: nan +/- nan
LOS: nan %, DrawRatio: 100.00 %, PairsRatio: -nan
Games: 2, Wins: 1, Losses: 1, Draws: 0, Points: 1.0 (50.00 %)
Ptnml(0-2): [0, 0, 1, 0, 0]
LLR: 0.00 (-2.94, 2.94) [0.00, 5.00]
--------------------------------------------------

log also shows its inputting the correct setoption

[Engine] [04:55:29.453200] <  5> Engine1 ---> readyok
[Engine] [04:55:29.453312] <  4> Engine2 <--- setoption name EvalFile value nn-ddcfb9224cdb.nnue
[Engine] [04:55:29.453447] <  4> Engine2 <--- setoption name EvalFileSmall value nn-37f18f62d772.nnue
[Engine] [04:55:29.453488] <  4> Engine2 <--- ucinewgame

perhaps theres something off with your configuration?

gahtan-syarif commented 2 weeks ago

im guessing the culprit is actually this

cmd=./stockfish_ee6fc7e38b4aeef44862159215a56d97122f59a0 dir=.\

and the error is incorrectly blaming it on EvalFileSmall as its the last option set for the engine

gahtan-syarif commented 2 weeks ago

fixed with https://github.com/Disservin/fast-chess/pull/530