Skip to content

Commit 2c6ef8c

Browse files
Allow more thorough checks of MultiPV lines (#166)
1 parent 28a15cd commit 2c6ef8c

5 files changed

Lines changed: 245212 additions & 98 deletions

File tree

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,26 @@ with the raw data in [`classic1000000.csv`](classic1000000.csv).
3636
### Usage of `matecheck.py`
3737

3838
```
39-
usage: matecheck.py [-h] [--engine ENGINE] [--timeout TIMEOUT] [--nodes NODES] [--depth DEPTH] [--time TIME] [--timeinc TIMEINC] [--mate MATE] [--hash HASH] [--threads THREADS]
40-
[--multiPV MULTIPV] [--checkMultiPVs] [--syzygyPath SYZYGYPATH] [--evalFile EVALFILE] [--syzygy50MoveRule SYZYGY50MOVERULE] [--maxTBscore MAXTBSCORE]
41-
[--minTBscore MINTBSCORE] [--maxValidMate MAXVALIDMATE] [--minValidMate MINVALIDMATE] [--concurrency CONCURRENCY] [--engineOpts ENGINEOPTS]
42-
[--epdFile EPDFILE [EPDFILE ...]] [--bmMin BMMIN] [--bmMax BMMAX] [--showAllIssues] [--shortTBPVonly] [--showAllStats] [--bench] [--logFile LOGFILE]
43-
[--foundMatesFile FOUNDMATESFILE]
39+
usage: matecheck.py [-h] [--epdFile EPDFILE [EPDFILE ...]] [--engine ENGINE] [--timeout TIMEOUT] [--nodes NODES] [--depth DEPTH] [--time TIME] [--timeinc TIMEINC] [--mate MATE] [--hash HASH] [--threads THREADS] [--multiPV MULTIPV] [--multipvFile MULTIPVFILE [MULTIPVFILE ...]] [--syzygyPath SYZYGYPATH] [--evalFile EVALFILE] [--syzygy50MoveRule SYZYGY50MOVERULE] [--maxTBscore MAXTBSCORE] [--minTBscore MINTBSCORE] [--maxValidMate MAXVALIDMATE] [--minValidMate MINVALIDMATE] [--concurrency CONCURRENCY] [--engineOpts ENGINEOPTS] [--bmMin BMMIN] [--bmMax BMMAX] [--showAllIssues] [--shortTBPVonly] [--showAllStats] [--bench] [--logFile LOGFILE] [--foundMatesFile FOUNDMATESFILE]
4440
4541
Check how many (best) mates an engine finds in e.g. matetrack.epd, a file with lines of the form "FEN bm #X;".
4642
4743
options:
4844
-h, --help show this help message and exit
45+
--epdFile EPDFILE [EPDFILE ...]
46+
file(s) containing the positions and their mate scores (default: ['matetrack.epd'])
4947
--engine ENGINE name of the engine binary (default: ./stockfish)
5048
--timeout TIMEOUT parameter passed to chess.engine.SimpleEngine (default: None)
5149
--nodes NODES nodes limit per position, default: 10**6 without other limits, otherwise None (default: None)
5250
--depth DEPTH depth limit per position (default: None)
5351
--time TIME time limit (in seconds) per position (default: None)
5452
--timeinc TIMEINC time increment (in seconds), with TIME passed as time remaining (default: None)
55-
--mate MATE mate limit per position: a value of 0 will use bm #X as the limit, a positive value (in the absence of other limits) means only elegible positions will be analysed
56-
(default: None)
53+
--mate MATE mate limit per position: a value of 0 will use bm #X as the limit, a positive value (in the absence of other limits) means only eligible positions will be analysed (default: None)
5754
--hash HASH hash table size in MB (default: None)
5855
--threads THREADS number of threads per position (values > 1 may lead to non-deterministic results) (default: None)
5956
--multiPV MULTIPV maximal number of lines to search per position, decisive scores in secondary lines are checked for validity (default: None)
60-
--checkMultiPVs also check PVs of secondary decisive scores for correctness and completeness (default: False)
57+
--multipvFile MULTIPVFILE [MULTIPVFILE ...]
58+
file(s) containing (some of) the positions' children and their possible mate scores (default: None)
6159
--syzygyPath SYZYGYPATH
6260
path(s) to syzygy EGTBs, with ':'/';' as separator on Linux/Windows (default: None)
6361
--evalFile EVALFILE path for the EvalFile to be used with the engine if the default net is not to be used (default: None)
@@ -75,8 +73,6 @@ options:
7573
total number of threads script may use, default: cpu_count() (default: 32)
7674
--engineOpts ENGINEOPTS
7775
json encoded dictionary of generic options, e.g. tuning parameters, to be used to initialize the engine (default: None)
78-
--epdFile EPDFILE [EPDFILE ...]
79-
file(s) containing the positions and their mate scores (default: ['matetrack.epd'])
8076
--bmMin BMMIN lower limit for |bm| for positions to analyse (default: None)
8177
--bmMax BMMAX upper limit for |bm| for positions to analyse (default: None)
8278
--showAllIssues show all unique UCI info lines with an issue, by default show for each FEN only the first occurrence of each possible type of issue (default: False)
@@ -111,6 +107,8 @@ contains illegal moves or does not end in checkmate.
111107
* **`matetrack.epd`**: The successor to `ChestUCI_23102018.epd`, with all illegal positions removed and all known errors corrected. The plots shown above are based on this file. It contains 6554 mate problems, ranging from mate in 1 (#1) to #126 for positions with between 4 and 32 pieces. In 26 positions the side to move is going to get mated.
112108
* `matetrackpv.epd`: The same as `matetrack.epd`, but for each position the file also includes a PV leading to the checkmate, if such a PV is known.
113109
* `matedtrack.epd`: Derived from `matetrackpv.epd` by applying a best move in all those positions, where the winning side is to move, and where a best move is known. The order of the positions in `matedtrack.epd` corresponds 1:1 to the order in `matetrack.epd`. So the new test suite still contains 6554 mate problems, but for 6549 of them the side to move is going to get mated. Observe that due to duplications, only 6531 of the latter positions are unique.
110+
* `matetrack_multipv.epd`: Fastest known mate values and associated PVs for the children of `matetrack.epd`, useful for running `matecheck.py` with `--multipvFile`.
111+
* `matedtrack_multipv.epd`: The same for `matedtrack.epd`.
114112
* `mates2000.epd`: A smaller test suite with 2000 positions ranging from #1 to #27. It contains a random selection of positions from `matetrack.epd` and `matedtrack.epd` that Stockfish can solve with 1M nodes. In 1105 positions the side to move is going to get mated.
115113
* `cursed.epd`: A collection of 125 cursed wins and 189 cursed losses, where wins and losses are denoted by `bm #1` and `bm #-1', respectively.
116114
* `KRvK1000.epd`: A collection of 1000 KRvK endgames, ranging from #4 to #16. In 529 positions the side to move is going to get mated.

check_engine.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ MAXTBSCORE=$DEFAULT_MAXTBSCORE
3131
MINTBSCORE=$DEFAULT_MINTBSCORE
3232
MAXVALIDMATE=$DEFAULT_MAXVALIDMATE
3333
MINVALIDMATE=$DEFAULT_MINVALIDMATE
34-
CHECKMULTIPVS=""
3534

3635
FAILS=0
3736

@@ -84,9 +83,6 @@ while [[ "$#" -gt 0 ]]; do
8483
MINVALIDMATE="$2"
8584
shift
8685
;;
87-
--checkMultiPVs)
88-
CHECKMULTIPVS="true"
89-
;;
9086
-h | --help)
9187
echo "Usage: $0 [OPTIONS]"
9288
echo "Options:"
@@ -97,7 +93,6 @@ while [[ "$#" -gt 0 ]]; do
9793
echo " --time <value> Number of seconds per position for gameplay tests (default: $DEFAULT_TIME)"
9894
echo " --timeinc <value> Time increment (in seconds) for gameplay tests (default: $DEFAULT_TIMEINC)"
9995
echo " -c, --concurrency <value> Total number of threads script may use (default: $DEFAULT_CONCURRENCY)"
100-
echo " --checkMultiPVs Parameter passed to matecheck.py"
10196
echo " --shortTBPVonly Parameter passed to matecheck.py"
10297
echo " --maxTBscore <value> Parameter passed to matecheck.py (default: $DEFAULT_MAXTBSCORE)"
10398
echo " --minTBscore <value> Parameter passed to matecheck.py (default: $DEFAULT_MINTBSCORE)"
@@ -136,9 +131,6 @@ if [ -n "$SYZYGY_PATH" ]; then
136131
FLAG_ARGS=("--shortTBPVonly")
137132
fi
138133
fi
139-
if [ -n "$CHECKMULTIPVS" ]; then
140-
FLAG_ARGS+=("--checkMultiPVs")
141-
fi
142134

143135
echo "Checking $ENGINE for correct $SCORES scores and complete PVs..."
144136

@@ -207,7 +199,7 @@ run_suite() {
207199
if ! echo "$UCI" | grep -q "MultiPV"; then
208200
echo -e "\n${RED}WARNING: Engine does not support UCI option MultiPV. Skipping th$th multiPV$egtb.$NOCOL"
209201
else
210-
run_test "th$th multiPV$egtb" "matecheck${th}mpv$suffix" "${SYZYGY_ARGS[@]}" "${FLAG_ARGS[@]}" --engine "$ENGINE" --epdFile mates2000.epd --nodes "$NODES" --multiPV 4 --threads "$th"
202+
run_test "th$th multiPV$egtb" "matecheck${th}mpv$suffix" "${SYZYGY_ARGS[@]}" "${FLAG_ARGS[@]}" --engine "$ENGINE" --epdFile mates2000.epd --nodes "$NODES" --multiPV 4 --multipvFile matetrack_multipv.epd matedtrack_multipv.epd --threads "$th"
211203
fi
212204
done
213205
}

0 commit comments

Comments
 (0)