fix(PX): 训练数据文件名加进程启动时间戳前缀,防止rsync覆盖旧文件
FlushGame 文件名从 game_00000.csv 改为 game_YYYYMMDD_HHMM_000000.csv。 _sessionPrefix 在类加载时固化,同一采集批次共享前缀,不同批次按启动时间区分。
This commit is contained in:
@ -14,6 +14,7 @@ namespace PdkFriendServer.Logic
|
||||
{
|
||||
public static bool Enabled = false;
|
||||
private static readonly List<TrainingRecord> _records = new List<TrainingRecord>();
|
||||
private static readonly string _sessionPrefix = DateTime.Now.ToString("yyyyMMdd_HHmm");
|
||||
|
||||
private static readonly int[] Ranks = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16 };
|
||||
private const int NumRanks = 13;
|
||||
@ -43,7 +44,7 @@ namespace PdkFriendServer.Logic
|
||||
public static void FlushGame(int gameId, float[] rewards, int winnerPos, string[] botTypes)
|
||||
{
|
||||
if (!Enabled || _records.Count == 0) return;
|
||||
var path = $"training_data/game_{gameId:D5}.csv";
|
||||
var path = $"training_data/game_{_sessionPrefix}_{gameId:D6}.csv";
|
||||
System.IO.Directory.CreateDirectory("training_data");
|
||||
using var w = new System.IO.StreamWriter(path);
|
||||
w.WriteLine("state,action,q_value,player");
|
||||
|
||||
Reference in New Issue
Block a user