Ajoute l Elo et les statistiques de parties

This commit is contained in:
2026-04-16 00:17:52 +02:00
parent db233e7110
commit 407e5e8ed5
13 changed files with 1914 additions and 11 deletions

View File

@@ -54,11 +54,14 @@ public static class MatchEngine
var quota = Presets[config.Preset].Quota;
var match = new MatchState
{
SchemaVersion = 3,
SchemaVersion = 4,
MatchId = Guid.NewGuid().ToString("N"),
Config = config,
Phase = PhaseBlock,
Running = false,
LastTickAt = null,
WhiteSubject = null,
BlackSubject = null,
BlockNumber = 1,
CurrentTurn = ColorWhite,
BlockRemainingMs = config.BlockDurationMs,
@@ -76,6 +79,7 @@ public static class MatchEngine
AwaitingBlockClosure = false,
ClosureReason = string.Empty,
Result = null,
ResultRecordedUtc = null,
Cube = CreateCubeState(),
DoubleCoup = new DoubleCoupState
{
@@ -115,13 +119,19 @@ public static class MatchEngine
};
storedMatch.Moves ??= new PlayerIntPair();
if (string.IsNullOrWhiteSpace(storedMatch.MatchId))
{
storedMatch.MatchId = Guid.NewGuid().ToString("N");
changed = true;
}
var blockDurationMs = GetBlockDurationMs(storedMatch);
var moveLimitMs = GetMoveLimitMs(storedMatch);
var timeInitialMs = GetTimeInitialMs(storedMatch);
if (storedMatch.SchemaVersion != 3)
if (storedMatch.SchemaVersion != 4)
{
storedMatch.SchemaVersion = 3;
storedMatch.SchemaVersion = 4;
changed = true;
}
@@ -826,7 +836,7 @@ public static class MatchEngine
}
public static bool IsSupportedSchemaVersion(int version)
=> version is 2 or 3;
=> version is 2 or 3 or 4;
public static long GetBlockDurationMs(object? matchOrConfig)
{