Références : format des analyses documenté et vérifié

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-03 14:51:41 +01:00
co-authored by Claude Opus 5.5
parent 242a2433d2
commit 7e958fab8e
2 changed files with 136 additions and 3 deletions
+47
View File
@@ -117,4 +117,51 @@ for f in results/*.json; do
printf '%s\n' "${ids[@]}" | grep -qxF "$id" || signaler "$f : position absente de positions.json"
done
# Analyses (README.md, section « Analyses ») : un résultat par cas, et les
# champs du format.
jq empty analyses.json || { echo "analyses.json : JSON invalide"; exit 1; }
read -r -d '' controle_analyse <<'JQ' || true
def nombre: type == "number";
def skill: IN("none", "doubtful", "bad", "very_bad");
if .type == "move" then
(if (.plies | keys) == ["0", "2"] and (.luck.value | nombre)
and (.luck.rating | IN("very_unlucky", "unlucky", "none", "lucky", "very_lucky"))
and all(.plies[]; (.move_count | nombre) and (.rank | nombre) and (.played_move | type) == "string"
and (.played_position_id | test("^[A-Za-z0-9+/]{14}$")) and (.played_equity | nombre)
and (.best_move | type) == "string" and (.best_equity | nombre)
and (.equity_loss | nombre) and .equity_loss <= 0 and (.skill | skill)
and (.ranking | length) >= ([.rank, ([.move_count, 10] | min)] | max))
then empty else "analyse de coup incomplète" end)
elif .type == "cube" then
(if (.plies | keys) == ["0", "2"] and (.action | IN("no_double", "double", "take", "pass"))
and all(.plies[]; (.analysed | type) == "boolean" and (.equity_loss | nombre)
and .equity_loss <= 0 and (.skill | skill)
and (if .analysed then (.cube.decision | type) == "string" else .cube == null end))
then empty else "analyse de videau incomplète" end)
elif .type == "level" then
(if (.levels | length) > 0 and all(.levels[]; (.plies | nombre) and (.noise | nombre)
and ((.move | type) == "string" or (.decision | type) == "string"))
then empty else "niveaux incomplets" end)
else "type inconnu" end
JQ
mapfile -t analyses < <(jq -r '(.moves + .cubes + .levels)[].id' analyses.json)
doublons="$(printf '%s\n' "${analyses[@]}" "${ids[@]}" | sort | uniq -d | paste -sd' ' -)"
[ -z "$doublons" ] || signaler "analyses.json : identifiants en double : $doublons"
for id in "${analyses[@]}"; do
f="analysis/$id.json"
if [ ! -f "$f" ]; then
signaler "$f absent : lancer make reference"
continue
fi
while read -r defaut; do
[ -n "$defaut" ] && signaler "$f : $defaut"
done < <(jq -r "$controle_analyse" "$f")
done
for f in analysis/*.json; do
[ -e "$f" ] || continue
printf '%s\n' "${analyses[@]}" | grep -qxF "$(basename "$f" .json)" \
|| signaler "$f : cas absent d'analyses.json"
done
[ "$erreurs" -eq 0 ]