F5: manutenzione delle industrie, livelli, borsa e scalate, agenti IA
- Sezione 11: usura e recupero degli impianti, fermi e incidenti, ricambi e macchinari come domanda esplicita (treno, trasporto locale, trasbordo nel bacino), revisione e ammodernamento, acquisto delle industrie dal livello 3, conguaglio mensile con il proprietario (ADR 0011). - Livelli della compagnia con soglie ritarate e ritaratura economica misurata con le IA. - Sezione 12.2–12.3: libro dei soci, prezzo con sentiment, quotazione, riacquisto, dividendi, controllo e fusione (comando 39), offerte pubbliche con difese, esiti per difficoltà, aste delle IA fallite, nuovi concorrenti, fine partita e Cronaca finale (ADR 0012). - Sezione 12.1: agenti IA con candidati, Dijkstra sulle celle, TrackPreview e ROI, tre personalità, linee dei ricambi, rimedio agli stalli, borsa (ADR 0013). - Salvataggio versione 3, protocollo (messaggi 126–128, blocchi di estensione), server, simulate --trace-ai; test di 14.5 su IA e borsa e accettazione F5 (120 test). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
This commit is contained in:
72 files changed
+5851
-122
No files matched your search
@@ -17,7 +17,7 @@ public sealed class SimulateCommand : IToolCommand
|
||||
{
|
||||
public string Name => "simulate";
|
||||
|
||||
public string Usage => "simulate --seed <n> --years <n> [--size 128] [--difficulty imprenditore] [--scenario <file>] [--out kpi.csv] [--save <file>]";
|
||||
public string Usage => "simulate --seed <n> --years <n> [--size 128] [--difficulty imprenditore] [--scenario <file>] [--out kpi.csv] [--save <file>] [--trace-ai]";
|
||||
|
||||
private static readonly CultureInfo It = CultureInfo.InvariantCulture;
|
||||
|
||||
@@ -30,7 +30,9 @@ public sealed class SimulateCommand : IToolCommand
|
||||
string? scenario = args.String("scenario");
|
||||
string output = args.String("out", "kpi.csv");
|
||||
string? savePath = args.String("save");
|
||||
bool trace = args.Flag("trace-ai");
|
||||
args.EnsureAllUsed();
|
||||
if (trace) Core.Simulation.Ai.AiSystem.Trace = Console.WriteLine;
|
||||
|
||||
var data = GameData.LoadDefault();
|
||||
var total = Stopwatch.StartNew();
|
||||
@@ -65,6 +67,8 @@ public sealed class SimulateCommand : IToolCommand
|
||||
Console.WriteLine($" data finale {world.Clock.Date}, hash {world.LastStateHash:x16}");
|
||||
Console.WriteLine($" popolazione {Core.Common.Money.GroupThousands((ulong)world.Towns.Sum(t => (long)t.Population))}, industrie aperte {world.Industries.Count(i => !i.Closed)} su {world.Industries.Count}");
|
||||
Console.WriteLine($" invarianti: denaro {(world.MoneyBalanceSum() == 0 ? "ok" : "ROTTO")}, merci {(Enumerable.Range(0, data.GoodCount).All(g => world.TotalStock(g) == world.Goods.ExpectedStock(g)) ? "ok" : "ROTTO")}");
|
||||
foreach (var c in world.Companies)
|
||||
Console.WriteLine($" {c.Name}: patrimonio {c.NetWorth}, cassa {c.Cash}, livello {c.Tier}, rating {c.Rating}, azione {c.SharePrice / 100:0.00} lire{AiNote(world, c)}{(c.Defunct ? " (fuori gioco)" : "")}");
|
||||
Console.WriteLine($" KPI in {output}");
|
||||
return 0;
|
||||
}
|
||||
@@ -91,12 +95,22 @@ public sealed class SimulateCommand : IToolCommand
|
||||
{
|
||||
long revenue = Company.Revenue(c.LastYearEntries);
|
||||
double share = totalCarrier > 0 ? (double)revenue / totalCarrier : 0;
|
||||
string note = $"{(c.IsPlayer ? "giocatore" : c.AiPersonality)}, rating {c.Rating}, livello {c.Tier}{(c.Bankrupt ? ", bancarotta" : "")}";
|
||||
string note = $"{(c.IsPlayer ? "giocatore" : c.AiPersonality)}, rating {c.Rating}, livello {c.Tier}{(c.Bankrupt ? ", bancarotta" : "")}{(c.Merged ? ", fusa" : "")}{AiNote(w, c)}";
|
||||
bool fleet = w.Trains.Any(t => !t.Removed && t.Owner == c.Id && t.Vehicles.Count > 0);
|
||||
csv.AppendLine(string.Join(';', year.ToString(It), c.Name, "", "", "", "", population.ToString(It), "",
|
||||
fleet ? Dec(Fleet.FleetCondition(w, c.Id)) : "", "", Dec(c.Cash.Lire), Dec(c.NetWorth.Lire), Dec(share), note));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Diagnostica dell'agente IA: progetti, treni, comandi rifiutati.</summary>
|
||||
private static string AiNote(World w, Company c)
|
||||
{
|
||||
var s = w.AiStates.FirstOrDefault(a => a.Company == c.Id);
|
||||
if (s is null) return "";
|
||||
int running = s.Projects.Count(p => p.Stage == Core.Simulation.Ai.AiProjectStage.Running);
|
||||
int trains = w.Trains.Count(t => !t.Removed && t.Owner == c.Id);
|
||||
return $", progetti {running}/{s.Projects.Count}, treni {trains}, città collegate {Tiers.ConnectedTowns(w, c.Id, 1000)} (≥1000) {Tiers.ConnectedTowns(w, c.Id, 2000)} (≥2000), comandi {s.Issued} (rifiutati {s.RejectedShare * 100:0.0} %)";
|
||||
}
|
||||
|
||||
private static string Dec(double v) => v.ToString("0.###", It).Replace('.', ',');
|
||||
}
|
||||
Reference in new issue
Block a user