Moteur : chances de gagner le match (table de gnubg), export SGF d'un match entier
Commande mwc d'engine-cli et engine_match_chances_of : chances au score (getMEAtScore) et conversion d'une équité (eq2mwc), comparées à gnubg de bureau. Export d'un match entier en SGF, relu par gnubg (load match). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ee661661fd
commit
f9b8663afb
@@ -838,6 +838,32 @@ engine_match_after_game(const char *match_id, int winner, int points,
|
||||
return ENGINE_OK;
|
||||
}
|
||||
|
||||
/* --------------------------------------- Chances de gagner le match */
|
||||
|
||||
engine_status
|
||||
engine_match_chances_of(const char *match_id, float equity, engine_match_chances *chances)
|
||||
{
|
||||
engine_match m;
|
||||
cubeinfo cube;
|
||||
engine_status status;
|
||||
|
||||
if (engine_state != READY)
|
||||
return ENGINE_ERROR_NOT_INITIALISED;
|
||||
status = engine_decode_match(match_id, &m);
|
||||
if (status != ENGINE_OK)
|
||||
return status;
|
||||
if (m.match_length == 0
|
||||
|| SetCubeInfo(&cube, m.cube_value, m.cube_owner, m.player_on_roll, m.match_length,
|
||||
m.score, m.crawford, m.jacoby, DEFAULT_BEAVERS, VARIATION_STANDARD) != 0)
|
||||
return ENGINE_ERROR_MATCH_ID;
|
||||
chances->at_score = getMEAtScore(m.score[0], m.score[1], m.match_length, m.player_on_roll,
|
||||
m.crawford, aafMET, aafMETPostCrawford);
|
||||
chances->mwc = eq2mwc(equity, &cube);
|
||||
/* analysis.c, updateStatcontext : « eq2mwc(rSkill, &ci) - eq2mwc(0.0f, &ci) ». */
|
||||
chances->loss = eq2mwc(equity, &cube) - eq2mwc(0.0f, &cube);
|
||||
return ENGINE_OK;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- Analyse d'une décision de videau */
|
||||
|
||||
/* Le plus petit de deux nombres. */
|
||||
|
||||
@@ -452,6 +452,32 @@ typedef struct {
|
||||
engine_status engine_match_after_game(const char *match_id, int winner, int points,
|
||||
engine_match_after *after);
|
||||
|
||||
/* Chances de gagner le match, d'après la table d'équité de match de gnubg
|
||||
* (Kazaross-XG2, celle de gnubg de bureau par défaut). */
|
||||
typedef struct {
|
||||
float at_score; /* chances du joueur au trait de gagner le match
|
||||
* au score du Match ID, avant la partie
|
||||
* (getMEAtScore de gnubg, matchequity.c,
|
||||
* partie Crawford et suivantes comprises) */
|
||||
float mwc; /* l'équité normalisée donnée, pour ce videau et
|
||||
* ce score, convertie en chances de gagner le
|
||||
* match du joueur au trait (eq2mwc) */
|
||||
float loss; /* la même équité vue comme une perte : eq2mwc
|
||||
* de l'équité moins eq2mwc de 0, comme le coût
|
||||
* d'une erreur dans les statistiques de match de
|
||||
* gnubg (updateStatcontext, analysis.c) */
|
||||
} engine_match_chances;
|
||||
|
||||
/*
|
||||
* Chances de gagner le match : au score du Match ID (avant la partie), et
|
||||
* pour une équité normalisée (videau, score, joueur au trait et partie
|
||||
* Crawford du Match ID ; les dés et le propriétaire du videau sont
|
||||
* ignorés). ENGINE_ERROR_MATCH_ID en partie libre (longueur 0) : il n'y a
|
||||
* pas de match.
|
||||
*/
|
||||
engine_status engine_match_chances_of(const char *match_id, float equity,
|
||||
engine_match_chances *chances);
|
||||
|
||||
/* ------------------------------------------------------------- Analyse */
|
||||
|
||||
/* Appréciation de gnubg pour une perte d'équité (0 ou négative). */
|
||||
|
||||
Reference in New Issue
Block a user