SimulationRun
namespace Griff.Simulations;
public sealed class SimulationRunOne run of a simulation: the pair of rows it plays (First against Second), the tables (with a sweep’s step in them), and what came of it: who won, how many turns and seconds it took, the damage each side dealt, what the first side earned (gold, XP) and any value tracked over the run. A script simulation fills it in; the no-code matchup fills it in from the arena’s fight; a scene run from the game it plays (Game) and its strategy.
Properties
Section titled “Properties”DamageDealt
Section titled “DamageDealt”public double DamageDealt { get; set; }The damage the first side dealt.
DamageTaken
Section titled “DamageTaken”public double DamageTaken { get; set; }The damage the first side took (the second side dealt).
public TableRow? First { get; }The first side’s row (a class, a hero), or null when that side has no table.
public Game? Game { get; }The game a scene run is playing, while it plays (in the strategy’s Setup, Act, IsOver and Done); null otherwise.
public int Index { get; }Which run of its pair this is, from 0.
IsEnding
Section titled “IsEnding”public bool IsEnding { get; }True once End is called: the scene run stops after the step under way.
Outcome
Section titled “Outcome”public int Outcome { get; }How it ended: 1 if the first side won, -1 if the second did, 0 for a draw (as it starts).
public Scene? Scene { get; }The scene the game is playing, while a scene run plays; null otherwise.
Second
Section titled “Second”public TableRow? Second { get; }The second side’s row (an enemy), or null when that side has no table.
Seconds
Section titled “Seconds”public double Seconds { get; set; }How many seconds of game time it took.
public int Seed { get; }The seed its random numbers come from.
public double? Step { get; }The value the sweep’s column has in this run (a level), or null without a sweep.
public long Steps { get; }How many steps its games have taken (a scene run’s, and its fights’).
Tables
Section titled “Tables”public TableSet Tables { get; }The game’s tables, with the sweep’s column at this step’s value.
public double Turns { get; set; }How many turns (rounds) it took.
Methods
Section titled “Methods”public void Draw()Nobody won (as a run starts).
public void Earn(string reward, double amount)The first side earns amount of reward (gold, XP): added to what it has earned this run, which is charted over the run, a point each time.
Earned
Section titled “Earned”public double Earned(string reward)What the first side has earned of reward this run so far.
public void End()Ends the scene run playing after the step under way, as its end condition would.
public SimulationFight Fight(TableRow? first, TableRow? second)Plays the simulation’s arena once with first against second (rows of any table; null plays a side’s entity as it is), by the game’s own rules, as the no-code matchup does. For scripts that string fights together.
public void Lose()The second side won.
public void Play()Plays the simulation’s scene from its start, headless and as fast as the computer goes, until its time limit, the scene changing, the game quitting or its end condition, with the run’s script as its strategy (its Setup, Act, IsOver and Done) and the tracked values read every Track Every seconds. What a script’s Run does unless it says otherwise; a script can call it more than once (a new game each time).
public void Track(string name, double value)A value over the run (health left, gold in hand, the level reached): a point on its chart each call, and its last value is its result, averaged over the runs. A run keeps its first MostPoints points (then the last takes the latest value), or every point, up to MostTrackedPoints, in a scene run or with Track Every set.
public void Win()The first side won.