feat: make tournament script use git tags instead of branches
this makes more sense and is more convenient (branches can only be checked out in one worktree)
This commit is contained in:
parent
5a9e17804c
commit
2569e36a5a
@ -1,21 +1,30 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Runs a fast-chess (https://github.com/Disservin/fastchess) tournament based
|
# Runs a fast-chess (https://github.com/Disservin/fastchess) tournament based
|
||||||
# on two branches of the chess_inator
|
# on two tags of the chess_inator (https://github.com/dogeystamp/chess_inator)
|
||||||
# (https://github.com/dogeystamp/chess_inator) engine.
|
# engine.
|
||||||
#
|
#
|
||||||
# Example usage:
|
# Example usage:
|
||||||
#
|
#
|
||||||
# cd chess_tournaments
|
# cd chess_tournaments
|
||||||
# fast-chess-branch.sh quiescence no-quiescence -openings file=8moves_v3.pgn format=pgn order=random -each tc=300+0.1 -rounds 12 -repeat -concurrency 8 -recover -sprt elo0=0 elo1=10 alpha=0.05 beta=0.05
|
# fast-chess-tag.sh quiescence no-quiescence -openings file=8moves_v3.pgn format=pgn order=random -each tc=300+0.1 -rounds 12 -repeat -concurrency 8 -recover -sprt elo0=0 elo1=10 alpha=0.05 beta=0.05
|
||||||
#
|
#
|
||||||
# Do not use `main` as a branch, or any other branch already checked out in
|
# You need to be in a chess_inator Git repository to run this script. Ensure
|
||||||
# another directory. You need to be in a chess_inator Git repository to run
|
# that the repository you're in is a throw-away worktree. Create one using:
|
||||||
# this script. Ensure that the repository you're in is a throw-away worktree.
|
|
||||||
# Create one using
|
|
||||||
#
|
#
|
||||||
# git worktree add ../chess_tournaments
|
# git worktree add ../chess_tournaments
|
||||||
#
|
#
|
||||||
# inside the original chess_inator repo.
|
# inside the original chess_inator repo.
|
||||||
|
#
|
||||||
|
# To create a git tag at the current commit, run
|
||||||
|
#
|
||||||
|
# git tag [tag_name]
|
||||||
|
#
|
||||||
|
# or to optionally annotate the tag,
|
||||||
|
#
|
||||||
|
# git tag -a [tag_name]
|
||||||
|
#
|
||||||
|
# which will prompt for a message.
|
||||||
|
#
|
||||||
# Also, get an opening book from Stockfish's books:
|
# Also, get an opening book from Stockfish's books:
|
||||||
#
|
#
|
||||||
# curl -O https://github.com/official-stockfish/books/raw/refs/heads/master/8moves_v3.pgn.zip
|
# curl -O https://github.com/official-stockfish/books/raw/refs/heads/master/8moves_v3.pgn.zip
|
||||||
@ -28,43 +37,45 @@
|
|||||||
# errors. The tournament automatically ends when a statistically significant
|
# errors. The tournament automatically ends when a statistically significant
|
||||||
# result is obtained.
|
# result is obtained.
|
||||||
#
|
#
|
||||||
|
# LOS stands for "likelihood of superiority", LLR "log likelihood ratio".
|
||||||
|
#
|
||||||
# By default, a PGN file will be exported with the games played, and the
|
# By default, a PGN file will be exported with the games played, and the
|
||||||
# fast-chess SPRT output will be appended. This comment may interfere with
|
# fast-chess SPRT output will be appended. This comment may interfere with
|
||||||
# importing the PGN. But Lichess will ignore it, so it's probably fine.
|
# importing the PGN. But Lichess will ignore it, so it's probably fine.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
BRANCH1="$1"
|
TAG1="$1"
|
||||||
BRANCH2="$2"
|
TAG2="$2"
|
||||||
|
|
||||||
# if this line fails it's because you don't have enough arguments
|
# if this line fails it's because you don't have enough arguments
|
||||||
shift 2
|
shift 2
|
||||||
|
|
||||||
COMM1=$(git rev-parse --short "$BRANCH1")
|
COMM1=$(git rev-parse --short "$TAG1")
|
||||||
COMM2=$(git rev-parse --short "$BRANCH2")
|
COMM2=$(git rev-parse --short "$TAG2")
|
||||||
|
|
||||||
mkdir -p games
|
mkdir -p games
|
||||||
|
|
||||||
PGN=games/"$BRANCH1"__"$BRANCH2".pgn
|
PGN=games/"$TAG1"__"$TAG2".pgn
|
||||||
|
|
||||||
rm -f engine1 engine2
|
rm -f engine1 engine2
|
||||||
if [ -f "$PGN" ]; then
|
if [ -f "$PGN" ]; then
|
||||||
rm -i "$PGN"
|
rm -i "$PGN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git switch "$BRANCH1"
|
git checkout "$TAG1"
|
||||||
cargo build --release
|
cargo build --release
|
||||||
cp target/release/chess_inator engine1
|
cp target/release/chess_inator engine1
|
||||||
|
|
||||||
git switch "$BRANCH2"
|
git checkout "$TAG2"
|
||||||
cargo build --release
|
cargo build --release
|
||||||
cp target/release/chess_inator engine2
|
cp target/release/chess_inator engine2
|
||||||
|
|
||||||
OUTPUT=$(mktemp)
|
OUTPUT=$(mktemp)
|
||||||
|
|
||||||
fastchess \
|
fastchess \
|
||||||
-engine cmd=engine1 name="c_i $BRANCH1 ($COMM1)" \
|
-engine cmd=engine1 name="c_i $TAG1 ($COMM1)" \
|
||||||
-engine cmd=engine2 name="c_i $BRANCH2 ($COMM2)" \
|
-engine cmd=engine2 name="c_i $TAG2 ($COMM2)" \
|
||||||
-pgnout file="$PGN" \
|
-pgnout file="$PGN" \
|
||||||
timeleft=true \
|
timeleft=true \
|
||||||
$@ \
|
$@ \
|
Loading…
Reference in New Issue
Block a user