Skip to content

SimulationResults

namespace Griff.Simulations;
public sealed class SimulationResults

What came of a Simulation: for each step of its sweep (one without), each pair of rows’ wins, losses and draws, turns and seconds, damage dealt and taken, gold and XP earned and the values tracked, averaged over its runs, with each side’s health and the tracked values over a run; as tables (ToTable, Matrix, SweepTable, OverARun) to show, chart and export, and Findings saying what stands out: one-sided pairs, rows far from the rest, levels that change nothing and levels that jump.

public TimeSpan Elapsed { get; }

How long they took.

public IReadOnlyList<string> Findings { get; }

What stands out, most striking first: one-sided pairs, rows far from the rest, dead levels and jumps.

public string FirstLabel { get; }

What the first side is called: its table’s name (“Classes”), or its entity’s.

public long GameSteps { get; }

How many steps the runs’ games took in all.

public bool IsSceneRun { get; }

True if it played a whole scene each run (see Scene), rather than fights.

public IReadOnlyList<string> Measures { get; }

What each pair has a value of: Win %, Loss %, Draw %, Turns, Seconds, Turns to Win, Seconds to Win, Damage Dealt, Damage Taken, then what the first side earned (Gold, XP) and the values tracked.

public string PointLabel { get; }

What each point of a value over a run is: “Turn” (each turn of a fight, or each second), or “Second” when they’re taken every so many seconds (named by the second of game time each is at).

public string SecondLabel { get; }

What the second side is called (“Enemies”).

public Simulation Simulation { get; }

The simulation as it was played.

public IReadOnlyList<SimulationStepResults> Steps { get; }

Each step of the sweep, in order; one without a sweep.

public double StepsPerSecond { get; }

How many game steps were played a second of real time, all the threads together.

public string Summary { get; }

A line saying what was played and how it went: “1,800 runs in 1.2 s on 16 threads. Classes win 61% of fights against Enemies, in 4.2 turns.”

public string? SweepLabel { get; }

The sweep’s column, e.g. “Level”, or null without a sweep.

public int Threads { get; }

How many threads shared them.

public int TotalRuns { get; }

How many runs were played in all.

public IReadOnlyList<string> Warnings { get; }

What the games said as they played (a Table Values naming a column the table hasn’t got), each once.

public Table Matrix(int step = 0, string measure = "Win %")

Every pair at step: a row for each of the first side’s rows, a column for each of the second’s, each cell the pair’s measure (its win rate by default): the matrix.

public static string Number(double value)

A number as the results write it: at most two places, trailing zeros dropped (4.25, 61.5, 12).

public Table OverARun(int step, int first, int second)

A pair’s values over a run, averaged over its runs: a row for each point (each turn, or each second without turns; named 1, 2, 3…; or every Track Every seconds, named by the second each is at: 0, 240, 480…), a column for each value (each side’s health, gold and XP earned, the tracked values).

public Table OverTime()

Every pair’s values over a run at every step, every point of them: a row for each point (named as in OverARun), a column for each pair’s each value (“Hire Early: Cash”, “Base Rent 300: Hire Early: Cash” in a sweep). What exporting the results writes beside them for values tracked every so many seconds.

public string PairName(SimulationPairResult pair)

What a pair is called: “Warrior vs Slime”, or in a scene run with no second table just its first row (“Hire Early”), or the scene’s name.

public static string Percent(double value)

A share out of 100 as the results write it: 61%, 4.5%.

public SimulationStepResults? StepAt(double? value)

The step whose sweep value is value (or the only one), or null.

public Table SweepTable(string measure = "Win %")

The sweep: a row for each step, named by its value (“1”, “2”, “3”, so it charts as a line over the levels), a column for all the first side’s rows together and one for each, each cell the measure averaged over the second side’s rows.

public Table ToTable(int step = -1)

A row a pair (“Warrior vs Slime”, “Level 3: Warrior vs Slime” in a sweep), with its sides’ rows, the sweep’s value and every measure: the results table. step -1 has every step’s pairs.

public const string WinRate

The measure that says how one-sided a pair is: the share of fights the first side won.