#!/usr/bin/env bash # Takes the ten screenshots of the website with the release build of ChessPenguin and # its dev hooks (docs/dev/desktop.md), in English, fullscreen (3840x2160 at scale 2). # Games: shots/classic-games.pgn (public-domain games, our own comments). Lists: a # large ChessBase database shown under a neutral name (hard links), never its annotations. # # website/shots/make-screenshots.sh "/path/to/Mega Database 2026.cbh" /path/to/sf_19 # The second argument is a directory with a downloaded `stockfish` (engines/sf_19). set -euo pipefail big="${1:?usage: $0 BIG_DATABASE.cbh STOCKFISH_DIR}" engine_dir="${2:?usage: $0 BIG_DATABASE.cbh STOCKFISH_DIR}" root="$(cd "$(dirname "$0")/../.." && pwd)" app="${root}/target/release/chesspenguin" out="${root}/website/shots/raw" work="${root}/target/site-shots" mkdir -p "${out}" "${work}" # The large database under a neutral name: every companion file hard-linked (a symlink # would be resolved to the original name by the app). db_dir="${work}/db" rm -rf "${db_dir}" && mkdir -p "${db_dir}" stem="$(basename "${big}" .cbh)" for f in "$(dirname "${big}")/${stem}".*; do [[ -f "${f}" ]] || continue ln "${f}" "${db_dir}/Tournament games${f#"$(dirname "${big}")/${stem}"}" done tournament="${db_dir}/Tournament games.cbh" classics="${db_dir}/Classic games.pgn" cp "${root}/website/shots/classic-games.pgn" "${classics}" # settings.json: English, the downloaded Stockfish, the databases in order. settings() { # dark board pieces first_db second_db cat < "${home}/cfg/chesspenguin/settings.json" ln -sfn "${engine_dir}" "${home}/data/chesspenguin/engines/sf_19" # The analysis cache is shared, so the game analysis is computed only once; NOCACHE # gives a shot its own empty cache (no engine marks). local cache="${work}/cache" if [[ "${1:-}" == NOCACHE ]]; then cache="${home}/cache"; rm -rf "${cache}"; shift; fi mkdir -p "${cache}" echo "== ${name}" # CP_* assignments go to the environment, the rest are the app's arguments. local vars=() args=() for a in "$@"; do if [[ "${a}" == CP_*=* ]]; then vars+=("${a}"); else args+=("${a}"); fi done env XDG_CONFIG_HOME="${home}/cfg" XDG_DATA_HOME="${home}/data" XDG_CACHE_HOME="${cache}" \ CP_SCREENSHOT="${out}/${name}.png" CP_SCREENSHOT_DELAY="${delay}" "${vars[@]}" "${app}" "${args[@]}" \ > "${home}/log" 2>&1 || true ls -la "${out}/${name}.png" } dark_games="$(settings true Brown Cburnett "${classics}" "${tournament}")" dark_big="$(settings true Brown Cburnett "${tournament}" "${classics}")" light_games="$(settings false Wood Celtic "${classics}" "${tournament}")" # Game analysis for the marks (Opera game) and the report (Evergreen game): computed # once into the shared cache. shot prep-opera "${dark_games}" 40 CP_OPEN=0 CP_REVIEW=1 shot prep-evergreen "${dark_games}" 60 CP_OPEN=2 CP_REVIEW=1 shot 01-game "${dark_games}" 4 NOCACHE CP_OPEN=0 CP_PLY=23 shot 02-engine "${dark_games}" 14 CP_OPEN=1 CP_PLY=35 CP_ANALYZE=1 CP_ENGINE_PANEL=1 shot 03-variations "${dark_games}" 4 NOCACHE CP_OPEN=0 CP_PLY=18 CP_VAR=1 shot 04-review "${dark_games}" 5 CP_OPEN=2 CP_PLY=37 CP_REPORT=1 shot 05-marks "${dark_games}" 5 CP_OPEN=0 CP_PLY=18 shot 06-preview "${dark_games}" 5 CP_OPEN=0 CP_BEST=3 shot 07-library "${dark_big}" 6 CP_PANE=hidden CP_SORT=date "${tournament}" shot 08-filters "${dark_big}" 6 "CP_FILTER=player=carlsen magnus;years=2015-2026;elo=2600" "${tournament}" shot 09-position-search "${dark_big}" 8 "CP_BOARD=e4 c5 Nf3 d6 d4 cxd4 Nxd4 Nf6 Nc3 a6" "${tournament}" shot 10-looks "${light_games}" 4 NOCACHE CP_OPEN=0 CP_PLY=23 CP_SETTINGS=board rm -f "${out}"/prep-*.png echo "Raw screenshots in ${out}; next: website/shots/derive.py"