summaryrefslogtreecommitdiff
path: root/src/eval_tune/test_vs_head.sh
blob: d6d9fba379d7bba8b7cc96629ba1f4eaaa6f8b84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
#
# Gated self-play match against a baseline binary. Historically this
# always compared the live working-tree build against head_reference/
# -- generalized (2026-09-14) to take both binary paths as args so two
# arbitrary builds (e.g. a file-storm-only worktree build vs. the
# current working tree, to isolate one change at a time when several
# have landed together -- see king_safety_data/HANDOFF.md's session
# notes on not measuring two eval changes in one match) can be compared
# without hand-rolling a match_play.py invocation each time.
#
# Usage: test_vs_head.sh [head_binary] [candidate_binary] [label]
#
#   head_binary       Baseline engine. Defaults to head_reference/typhoon
#                      (the usual "is this better than last checkpoint"
#                      question).
#   candidate_binary   Candidate engine. Defaults to a fresh copy of the
#                      live working-tree build (../typhoon) into
#                      /tmp/typhoon/typhoon_match_play_candidate -- pass
#                      an explicit path (already built) to skip that
#                      copy/freeze step entirely, e.g. when comparing
#                      two prebuilt worktree binaries.
#   label              Distinguishes scratch dir/log/pgn-out so multiple
#                      matches can run concurrently without colliding.
#                      Defaults to "match".
#
# Examples:
#   test_vs_head.sh                                                    # old default behavior
#   test_vs_head.sh /tmp/typhoon/filestorm_only /tmp/typhoon/candidate queenprox_backflight

set -e

HEAD="${1:-../../head_reference/typhoon}"
LABEL="${3:-match}"

if [ -n "$2" ]; then
    CANDIDATE="$2"
else
    cd ..
    gmake clean
    gmake release MP=1 PERF_COUNTERS=1
    cd eval_tune
    CANDIDATE=/tmp/typhoon/typhoon_match_play_candidate
    cp -f ../typhoon ${CANDIDATE}
fi

python3 ./match_play.py \
        ${HEAD} \
        ${CANDIDATE} \
        --pgn ../../pgn/twic_filtered.pgn \
        --games 10000 \
        --workers 12 \
        --st 4 \
        --sprt --elo0 0 --elo1 5 \
        --scratch /usr/local/tmp/typhoon_match_${LABEL} \
        --log ${LABEL}.log \
        --pgn-out ../${LABEL}_games.pgn