Update timeline designator usage
Timelines are now identified by strings and come first in timeline-turn tuples.
This commit is contained in:
parent
3d48a7d6f6
commit
9696919773
92
MDATC.html
92
MDATC.html
|
@ -236,17 +236,13 @@
|
||||||
<a name="2.B"><h3>2.B. ORDER NOTATION</h3></a>
|
<a name="2.B"><h3>2.B. ORDER NOTATION</h3></a>
|
||||||
<p>The order notation in this document is as in DATC, with the following additions for multiversal time travel.</p>
|
<p>The order notation in this document is as in DATC, with the following additions for multiversal time travel.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>A season within a particular timeline is designated in the format X:Y, where X is the turn (starting from 0 and advancing with each movement phase) and Y is the timeline number (starting from 0 and advancing with each timeline fork).</li>
|
<li>Timelines are designated by letters, e.g. "a", "b". Turns are designated by numbers, e.g. 0, 1, 2. A board in a timeline X at turn N is designated XN. A location LOC on that board is designated X-LOC@N.</li>
|
||||||
<li>Adjudication is implied to be done between successive seasons. For example, if orders are listed for 0:0 and then for 1:0, it is implied that the orders for 0:0 were adjudicated.</li>
|
<li>In examples that cover multiple turns, orders are given in sets. Each order set is adjudicated before moving on to the next set.</li>
|
||||||
<li>Units are designated by unit type, province, and season, e.g. "A Munich 1:0". A destination for a move order or support-to-move order is designated by province and season, e.g. "Munich 1:0".
|
<li>Units are fully designated by unit type and multiversal location, e.g. "A b-Munich@3". Destinations for move orders or support-to-move orders are fully designated by multiversal location, e.g. <code>a-Munich@1</code>. Where orders are not fully designated, the full designations are implied according to these rules:</li>
|
||||||
<ul>
|
<ul>
|
||||||
<li>If season of the ordered unit is not specified, the season is the season to which the orders are being given.</li>
|
<li>If only the timeline of a location is specified, the turn is the latest turn in that timeline. E.g. if timeline "a" is at turn 2, <code>a-Munich</code> is interpreted as <code>a-Munich@2</code>.</li>
|
||||||
<li>If the season of a unit supported to hold is not specified, the season is the same season as the supporting unit.</li>
|
<li>If the timeline or turn are unspecified for the target of a move or support-hold order, the timeline and turn are those of the ordered unit. E.g. if timeline "b" is at turn 1, <code>A b-Tyrolia - Munich</code> is interpreted as <code>b-Tyrolia@1 - b-Munich@1</code>.</li>
|
||||||
<li>If the season of the destination of a move order or the season of the destination of a supported move order is not specified, the season is the season of the moving unit.</li>
|
<li>If only the province is specified for the target of a support-move order, the timeline and turn are those of the supported unit. E.g. if timeline "a" is at turn 2 and "b" at turn 1, <code>A a-Munich supports A b-Tyrolia - Munich</code> is interpreted as <code>A a-Munich@2 supports A b-Tyrolia@1 - b-Munich@1</code>.</li>
|
||||||
<li>For example:
|
|
||||||
<pre>Germany 2:0
|
|
||||||
A Munich supports A Munich 1:1 - Tyrolia</pre>
|
|
||||||
The order here is for Army Munich in 2:0. The move being supported is for Army Munich in 1:1 to move to Tyrolia in 1:1.</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -258,13 +254,15 @@ The order here is for Army Munich in 2:0. The move being supported is for Army M
|
||||||
<summary><h4><a href="#3.A.1">3.A.1</a>. TEST CASE, MOVE INTO OWN PAST FORKS TIMELINE</h4></summary>
|
<summary><h4><a href="#3.A.1">3.A.1</a>. TEST CASE, MOVE INTO OWN PAST FORKS TIMELINE</h4></summary>
|
||||||
<p>A unit that moves into its own immediate past causes the timeline to fork.</p>
|
<p>A unit that moves into its own immediate past causes the timeline to fork.</p>
|
||||||
<pre>
|
<pre>
|
||||||
Germany 0:0
|
Germany:
|
||||||
A Munich hold
|
A a-Munich hold
|
||||||
|
|
||||||
Germany 1:0
|
---
|
||||||
A Munich - Tyrolia 0:0
|
|
||||||
|
Germany:
|
||||||
|
A a-Munich - a-Tyrolia@0
|
||||||
</pre>
|
</pre>
|
||||||
<p>A Munich 1:0 moves to Tyrolia 0:0. The main timeline advances to 2:0 with an empty board. A forked timeline advances to 1:1 with armies in Munich and Tyrolia.</p>
|
<p>A a-Munich@1 moves to a-Tyrolia@0. The main timeline advances to a2 with an empty board. A forked timeline advances to b1 with armies in Munich and Tyrolia.</p>
|
||||||
<div class="figures">
|
<div class="figures">
|
||||||
<canvas id="canvas-3-A-1-before" width="0" height="0"></canvas>
|
<canvas id="canvas-3-A-1-before" width="0" height="0"></canvas>
|
||||||
<script>
|
<script>
|
||||||
|
@ -311,19 +309,21 @@ The order here is for Army Munich in 2:0. The move being supported is for Army M
|
||||||
<summary><h4><a href="#3.A.2">3.A.2</a>. TEST CASE, SUPPORT TO REPELLED PAST MOVE FORKS TIMELINE</h4></summary>
|
<summary><h4><a href="#3.A.2">3.A.2</a>. TEST CASE, SUPPORT TO REPELLED PAST MOVE FORKS TIMELINE</h4></summary>
|
||||||
<p>A unit that supports a move that previously failed in the past, such that it now succeeds, causes the timeline to fork.</p>
|
<p>A unit that supports a move that previously failed in the past, such that it now succeeds, causes the timeline to fork.</p>
|
||||||
<pre>
|
<pre>
|
||||||
Austria 0:0
|
Austria:
|
||||||
A Tyrolia hold
|
A Tyrolia hold
|
||||||
|
|
||||||
Germany 0:0
|
Germany:
|
||||||
A Munich - Tyrolia
|
A Munich - Tyrolia
|
||||||
|
|
||||||
Austria 1:0
|
---
|
||||||
|
|
||||||
|
Austria:
|
||||||
A Tyrolia hold
|
A Tyrolia hold
|
||||||
|
|
||||||
Germany 1:0
|
Germany:
|
||||||
A Munich supports A Munich 0:0 - Tyrolia 0:0
|
A Munich supports A a-Munich@0 - Tyrolia
|
||||||
</pre>
|
</pre>
|
||||||
<p>With the support from A Munich 1:0, A Munich 0:0 dislodges A Tyrolia 0:0. A forked timeline advances to 1:1 where A Tyrolia 0:0 has been dislodged. The main timeline advances to 2:0 where A Munich and A Tyrolia are in their initial positions.</p>
|
<p>With the support from A a-Munich@1, A a-Munich@0 dislodges A a-Tyrolia@0. A forked timeline advances to b1 where A Tyrolia has been dislodged. The main timeline advances to a2 where A Munich and A Tyrolia are in their initial positions.</p>
|
||||||
<div class="figures">
|
<div class="figures">
|
||||||
<canvas id="canvas-3-A-2-before" width="0" height="0"></canvas>
|
<canvas id="canvas-3-A-2-before" width="0" height="0"></canvas>
|
||||||
<script>
|
<script>
|
||||||
|
@ -379,19 +379,21 @@ The order here is for Army Munich in 2:0. The move being supported is for Army M
|
||||||
<summary><h4><a href="#3.A.3">3.A.3</a>. TEST CASE, FAILED MOVE DOES NOT FORK TIMELINE</h4></summary>
|
<summary><h4><a href="#3.A.3">3.A.3</a>. TEST CASE, FAILED MOVE DOES NOT FORK TIMELINE</h4></summary>
|
||||||
<p>A unit that attempts to move into the past, but is repelled, does not cause the timeline to fork.</p>
|
<p>A unit that attempts to move into the past, but is repelled, does not cause the timeline to fork.</p>
|
||||||
<pre>
|
<pre>
|
||||||
Austria 0:0
|
Austria:
|
||||||
A Tyrolia hold
|
A Tyrolia hold
|
||||||
|
|
||||||
Germany 0:0
|
Germany:
|
||||||
A Munich hold
|
A Munich hold
|
||||||
|
|
||||||
Austria 1:0
|
---
|
||||||
|
|
||||||
|
Austria:
|
||||||
A Tyrolia hold
|
A Tyrolia hold
|
||||||
|
|
||||||
Germany 1:0
|
Germany:
|
||||||
A Munich - Tyrolia 0:0
|
A Munich - a-Tyrolia@0
|
||||||
</pre>
|
</pre>
|
||||||
<p>The move by A Munich 1:0 fails. The main timeline advances to 2:0 with both armies in their initial positions. No alternate timeline is created.</p>
|
<p>The move by A a-Munich@1 fails. The main timeline advances to a2 with both armies in their initial positions. No alternate timeline is created.</p>
|
||||||
<div class="figures">
|
<div class="figures">
|
||||||
<canvas id="canvas-3-A-3-before" width="0" height="0"></canvas>
|
<canvas id="canvas-3-A-3-before" width="0" height="0"></canvas>
|
||||||
<script>
|
<script>
|
||||||
|
@ -441,15 +443,17 @@ The order here is for Army Munich in 2:0. The move being supported is for Army M
|
||||||
<summary><h4><a href="#3.A.4">3.A.4</a>. TEST CASE, SUPERFLUOUS SUPPORT DOES NOT FORK TIMELINE</h4></summary>
|
<summary><h4><a href="#3.A.4">3.A.4</a>. TEST CASE, SUPERFLUOUS SUPPORT DOES NOT FORK TIMELINE</h4></summary>
|
||||||
<p>A unit that supports a move that succeeded in the past and still succeeds after the additional future support does not cause the timeline to fork.</p>
|
<p>A unit that supports a move that succeeded in the past and still succeeds after the additional future support does not cause the timeline to fork.</p>
|
||||||
<pre>
|
<pre>
|
||||||
Germany 0:0
|
Germany:
|
||||||
A Munich - Tyrolia
|
A Munich - Tyrolia
|
||||||
A Bohemia hold
|
A Bohemia hold
|
||||||
|
|
||||||
Germany 1:0
|
---
|
||||||
|
|
||||||
|
Germany:
|
||||||
A Tyrolia hold
|
A Tyrolia hold
|
||||||
A Bohemia supports A Munich 0:0 - Tyrolia
|
A Bohemia supports A a-Munich@0 - Tyrolia
|
||||||
</pre>
|
</pre>
|
||||||
<p>Both units in 1:0 continue to 2:0. No alternate timeline is created.</p>
|
<p>Both units in a1 continue to a2. No alternate timeline is created.</p>
|
||||||
<div class="figures">
|
<div class="figures">
|
||||||
<canvas id="canvas-3-A-4-before" width="0" height="0"></canvas>
|
<canvas id="canvas-3-A-4-before" width="0" height="0"></canvas>
|
||||||
<script>
|
<script>
|
||||||
|
@ -501,15 +505,15 @@ The order here is for Army Munich in 2:0. The move being supported is for Army M
|
||||||
<summary><h4><a href="#3.A.5">3.A.5</a>. TEST CASE, CROSS-TIMELINE SUPPORT DOES NOT FORK HEAD</h4></summary>
|
<summary><h4><a href="#3.A.5">3.A.5</a>. TEST CASE, CROSS-TIMELINE SUPPORT DOES NOT FORK HEAD</h4></summary>
|
||||||
<p>In this test case, a unit elsewhere on the map moves into the past to cause a timeline fork. Once there are two parallel timelines, a support from one to the head of the other should not cause any forking, since timeline forks only occur when the past changes, not the present.</p>
|
<p>In this test case, a unit elsewhere on the map moves into the past to cause a timeline fork. Once there are two parallel timelines, a support from one to the head of the other should not cause any forking, since timeline forks only occur when the past changes, not the present.</p>
|
||||||
<pre>
|
<pre>
|
||||||
Austria
|
Austria:
|
||||||
A Tyrolia 2:0 hold
|
A a-Tyrolia hold
|
||||||
A Tyrolia 1:1 hold
|
A b-Tyrolia hold
|
||||||
|
|
||||||
Germany
|
Germany
|
||||||
A Munich 2:0 - Tyrolia
|
A a-Munich - Tyrolia
|
||||||
A Munich 1:1 supports A Munich 2:0 - Tyrolia
|
A b-Munich supports A a-Munich - Tyrolia
|
||||||
</pre>
|
</pre>
|
||||||
<p>A Munich 2:0 dislodges A Tyrolia 2:0. No alternate timeline is created.</p>
|
<p>A a-Munich dislodges A a-Tyrolia. No alternate timeline is created.</p>
|
||||||
<div class="figures">
|
<div class="figures">
|
||||||
<canvas id="canvas-3-A-5-before" width="0" height="0"></canvas>
|
<canvas id="canvas-3-A-5-before" width="0" height="0"></canvas>
|
||||||
<script>
|
<script>
|
||||||
|
@ -567,19 +571,11 @@ The order here is for Army Munich in 2:0. The move being supported is for Army M
|
||||||
<p>Following <a href="#3.A.5">3.A.5</a>, a cross-timeline support that previously succeeded is cut.</p>
|
<p>Following <a href="#3.A.5">3.A.5</a>, a cross-timeline support that previously succeeded is cut.</p>
|
||||||
<pre>
|
<pre>
|
||||||
Germany
|
Germany
|
||||||
A Munich 2:0 - Tyrolia
|
A a-Tyrolia holds
|
||||||
A Munich 1:1 supports A Munich 2:0 - Tyrolia
|
A b-Munich holds
|
||||||
|
|
||||||
Austria
|
Austria
|
||||||
A Tyrolia 2:0 holds
|
A b-Tyrolia@2 - b-Munich@1
|
||||||
A Tyrolia 1:1 holds
|
|
||||||
|
|
||||||
Germany
|
|
||||||
A Tyrolia 3:0 holds
|
|
||||||
A Munich 2:1 holds
|
|
||||||
|
|
||||||
Austria
|
|
||||||
A Tyrolia 2:1 - Munich 1:1
|
|
||||||
</pre>
|
</pre>
|
||||||
<p>Cutting the support does not change the past or cause a timeline fork.</p>
|
<p>Cutting the support does not change the past or cause a timeline fork.</p>
|
||||||
<div class="figures">
|
<div class="figures">
|
||||||
|
|
|
@ -27,12 +27,12 @@ public class Season
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The timeline to which this season belongs.
|
/// The timeline to which this season belongs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Timeline { get; }
|
public string Timeline { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The season's spatial location as a turn-timeline tuple.
|
/// The season's spatial location as a timeline-turn tuple.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public (int Turn, int Timeline) Coord => (this.Turn, this.Timeline);
|
public (string Timeline, int Turn) Coord => (this.Timeline, this.Turn);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The shared timeline number generator.
|
/// The shared timeline number generator.
|
||||||
|
@ -45,18 +45,15 @@ public class Season
|
||||||
public IEnumerable<Season> Futures => this.FutureList;
|
public IEnumerable<Season> Futures => this.FutureList;
|
||||||
private List<Season> FutureList { get; }
|
private List<Season> FutureList { get; }
|
||||||
|
|
||||||
private Season(Season? past, int turn, int timeline, TimelineFactory factory)
|
private Season(Season? past, int turn, string timeline, TimelineFactory factory)
|
||||||
{
|
{
|
||||||
this.Past = past;
|
this.Past = past;
|
||||||
this.Turn = turn;
|
this.Turn = turn;
|
||||||
this.Timeline = timeline;
|
this.Timeline = timeline;
|
||||||
this.Timelines = factory;
|
this.Timelines = factory;
|
||||||
this.FutureList = new();
|
this.FutureList = [];
|
||||||
|
|
||||||
if (past != null)
|
past?.FutureList.Add(this);
|
||||||
{
|
|
||||||
past.FutureList.Add(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -73,7 +70,7 @@ public class Season
|
||||||
return new Season(
|
return new Season(
|
||||||
past: null,
|
past: null,
|
||||||
turn: FIRST_TURN,
|
turn: FIRST_TURN,
|
||||||
timeline: TimelineFactory.StringToInt(factory.NextTimeline()),
|
timeline: factory.NextTimeline(),
|
||||||
factory: factory);
|
factory: factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,13 +78,13 @@ public class Season
|
||||||
/// Create a season immediately after this one in the same timeline.
|
/// Create a season immediately after this one in the same timeline.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Season MakeNext()
|
public Season MakeNext()
|
||||||
=> new Season(this, this.Turn + 1, this.Timeline, this.Timelines);
|
=> new(this, Turn + 1, Timeline, Timelines);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a season immediately after this one in a new timeline.
|
/// Create a season immediately after this one in a new timeline.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Season MakeFork()
|
public Season MakeFork()
|
||||||
=> new Season(this, this.Turn + 1, TimelineFactory.StringToInt(Timelines.NextTimeline()), this.Timelines);
|
=> new(this, Turn + 1, Timelines.NextTimeline(), Timelines);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the first season in this season's timeline. The first season is the
|
/// Returns the first season in this season's timeline. The first season is the
|
||||||
|
@ -127,7 +124,7 @@ public class Season
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<Season> GetAdjacentSeasons()
|
public IEnumerable<Season> GetAdjacentSeasons()
|
||||||
{
|
{
|
||||||
List<Season> adjacents = new();
|
List<Season> adjacents = [];
|
||||||
|
|
||||||
// The immediate past and all immediate futures are adjacent.
|
// The immediate past and all immediate futures are adjacent.
|
||||||
if (this.Past != null) adjacents.Add(this.Past);
|
if (this.Past != null) adjacents.Add(this.Past);
|
||||||
|
|
|
@ -207,29 +207,27 @@ public class World
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a season by coordinate. Throws if the season is not found.
|
/// Get a season by coordinate. Throws if the season is not found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Season GetSeason(int turn, int timeline)
|
public Season GetSeason(string timeline, int turn)
|
||||||
{
|
{
|
||||||
Season? foundSeason = this.Seasons.SingleOrDefault(
|
Season? foundSeason = this.Seasons.SingleOrDefault(
|
||||||
s => s!.Turn == turn && s.Timeline == timeline,
|
s => s!.Turn == turn && s.Timeline == timeline,
|
||||||
null);
|
null)
|
||||||
if (foundSeason == null) throw new KeyNotFoundException(
|
?? throw new KeyNotFoundException($"Season {timeline}@{turn} not found");
|
||||||
$"Season {turn}:{timeline} not found");
|
|
||||||
return foundSeason;
|
return foundSeason;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a unit in a province. Throws if there are duplicate units.
|
/// Returns a unit in a province. Throws if there are duplicate units.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Unit GetUnitAt(string provinceName, (int turn, int timeline)? seasonCoord = null)
|
public Unit GetUnitAt(string provinceName, (string timeline, int turn)? seasonCoord = null)
|
||||||
{
|
{
|
||||||
Province province = Map.GetProvince(provinceName);
|
Province province = Map.GetProvince(provinceName);
|
||||||
seasonCoord ??= (this.RootSeason.Turn, this.RootSeason.Timeline);
|
seasonCoord ??= (this.RootSeason.Timeline, this.RootSeason.Turn);
|
||||||
Season season = GetSeason(seasonCoord.Value.turn, seasonCoord.Value.timeline);
|
Season season = GetSeason(seasonCoord.Value.timeline, seasonCoord.Value.turn);
|
||||||
Unit? foundUnit = this.Units.SingleOrDefault(
|
Unit? foundUnit = this.Units.SingleOrDefault(
|
||||||
u => u!.Province == province && u.Season == season,
|
u => u!.Province == province && u.Season == season,
|
||||||
null);
|
null)
|
||||||
if (foundUnit == null) throw new KeyNotFoundException(
|
?? throw new KeyNotFoundException($"Unit at {province} at {season} not found");
|
||||||
$"Unit at {province} at {season} not found");
|
|
||||||
return foundUnit;
|
return foundUnit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class TimeTravelTest
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
||||||
|
|
||||||
// Hold to move into the future, then move back into the past.
|
// Hold to move into the future, then move back into the past.
|
||||||
setup[(0, 0)]
|
setup[("a", 0)]
|
||||||
.GetReference(out Season s0)
|
.GetReference(out Season s0)
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").Holds().GetReference(out var mun0)
|
.Army("Mun").Holds().GetReference(out var mun0)
|
||||||
.Execute()
|
.Execute()
|
||||||
[(1, 0)]
|
[("a", 1)]
|
||||||
.GetReference(out Season s1)
|
.GetReference(out Season s1)
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").MovesTo("Tyr", season: s0).GetReference(out var mun1);
|
.Army("Mun").MovesTo("Tyr", season: s0).GetReference(out var mun1);
|
||||||
|
@ -41,15 +41,15 @@ public class TimeTravelTest
|
||||||
Is.EqualTo(1),
|
Is.EqualTo(1),
|
||||||
"Failed to fork timeline when unit moved in");
|
"Failed to fork timeline when unit moved in");
|
||||||
|
|
||||||
// Confirm that there is a unit in Tyr 1:1 originating from Mun 1:0
|
// Confirm that there is a unit in Tyr b1 originating from Mun a1
|
||||||
Season fork = world.GetSeason(1, 1);
|
Season fork = world.GetSeason("b", 1);
|
||||||
Unit originalUnit = world.GetUnitAt("Mun", s0.Coord);
|
Unit originalUnit = world.GetUnitAt("Mun", s0.Coord);
|
||||||
Unit aMun0 = world.GetUnitAt("Mun", s1.Coord);
|
Unit aMun0 = world.GetUnitAt("Mun", s1.Coord);
|
||||||
Unit aTyr = world.GetUnitAt("Tyr", fork.Coord);
|
Unit aTyr = world.GetUnitAt("Tyr", fork.Coord);
|
||||||
Assert.That(aTyr.Past, Is.EqualTo(mun1.Order.Unit));
|
Assert.That(aTyr.Past, Is.EqualTo(mun1.Order.Unit));
|
||||||
Assert.That(aTyr.Past?.Past, Is.EqualTo(mun0.Order.Unit));
|
Assert.That(aTyr.Past?.Past, Is.EqualTo(mun0.Order.Unit));
|
||||||
|
|
||||||
// Confirm that there is a unit in Mun 1:1 originating from Mun 0:0
|
// Confirm that there is a unit in Mun b1 originating from Mun a0
|
||||||
Unit aMun1 = world.GetUnitAt("Mun", fork.Coord);
|
Unit aMun1 = world.GetUnitAt("Mun", fork.Coord);
|
||||||
Assert.That(aMun1.Past, Is.EqualTo(originalUnit));
|
Assert.That(aMun1.Past, Is.EqualTo(originalUnit));
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class TimeTravelTest
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
||||||
|
|
||||||
// Fail to dislodge on the first turn, then support the move so it succeeds.
|
// Fail to dislodge on the first turn, then support the move so it succeeds.
|
||||||
setup[(0, 0)]
|
setup[("a", 0)]
|
||||||
.GetReference(out Season s0)
|
.GetReference(out Season s0)
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").MovesTo("Tyr").GetReference(out var mun0)
|
.Army("Mun").MovesTo("Tyr").GetReference(out var mun0)
|
||||||
|
@ -75,7 +75,7 @@ public class TimeTravelTest
|
||||||
Assert.That(tyr0, Is.NotDislodged);
|
Assert.That(tyr0, Is.NotDislodged);
|
||||||
setup.UpdateWorld();
|
setup.UpdateWorld();
|
||||||
|
|
||||||
setup[(1, 0)]
|
setup[("a", 1)]
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").Supports.Army("Mun", season: s0).MoveTo("Tyr").GetReference(out var mun1)
|
.Army("Mun").Supports.Army("Mun", season: s0).MoveTo("Tyr").GetReference(out var mun1)
|
||||||
["Austria"]
|
["Austria"]
|
||||||
|
@ -91,16 +91,16 @@ public class TimeTravelTest
|
||||||
|
|
||||||
// Confirm that an alternate future is created.
|
// Confirm that an alternate future is created.
|
||||||
World world = setup.UpdateWorld();
|
World world = setup.UpdateWorld();
|
||||||
Season fork = world.GetSeason(1, 1);
|
Season fork = world.GetSeason("b", 1);
|
||||||
Unit tyr1 = world.GetUnitAt("Tyr", fork.Coord);
|
Unit tyr1 = world.GetUnitAt("Tyr", fork.Coord);
|
||||||
Assert.That(
|
Assert.That(
|
||||||
tyr1.Past,
|
tyr1.Past,
|
||||||
Is.EqualTo(mun0.Order.Unit),
|
Is.EqualTo(mun0.Order.Unit),
|
||||||
"Expected A Mun 0:0 to advance to Tyr 1:1");
|
"Expected A Mun a0 to advance to Tyr b1");
|
||||||
Assert.That(
|
Assert.That(
|
||||||
world.RetreatingUnits.Count,
|
world.RetreatingUnits.Count,
|
||||||
Is.EqualTo(1),
|
Is.EqualTo(1),
|
||||||
"Expected A Tyr 0:0 to be in retreat");
|
"Expected A Tyr a0 to be in retreat");
|
||||||
Assert.That(world.RetreatingUnits.First().Unit, Is.EqualTo(tyr0.Order.Unit));
|
Assert.That(world.RetreatingUnits.First().Unit, Is.EqualTo(tyr0.Order.Unit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ public class TimeTravelTest
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
||||||
|
|
||||||
// Hold to create a future, then attempt to attack in the past.
|
// Hold to create a future, then attempt to attack in the past.
|
||||||
setup[(0, 0)]
|
setup[("a", 0)]
|
||||||
.GetReference(out Season s0)
|
.GetReference(out Season s0)
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").Holds()
|
.Army("Mun").Holds()
|
||||||
["Austria"]
|
["Austria"]
|
||||||
.Army("Tyr").Holds().GetReference(out var tyr0)
|
.Army("Tyr").Holds().GetReference(out var tyr0)
|
||||||
.Execute()
|
.Execute()
|
||||||
[(1, 0)]
|
[("a", 1)]
|
||||||
.GetReference(out Season s1)
|
.GetReference(out Season s1)
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").MovesTo("Tyr", season: s0).GetReference(out var mun1)
|
.Army("Mun").MovesTo("Tyr", season: s0).GetReference(out var mun1)
|
||||||
|
@ -128,7 +128,7 @@ public class TimeTravelTest
|
||||||
Assert.That(mun1, Is.Valid);
|
Assert.That(mun1, Is.Valid);
|
||||||
setup.AdjudicateOrders();
|
setup.AdjudicateOrders();
|
||||||
Assert.That(mun1, Is.Repelled);
|
Assert.That(mun1, Is.Repelled);
|
||||||
// The order to Tyr 0:0 should have been pulled into the adjudication set, so the reference
|
// The order to Tyr a0 should have been pulled into the adjudication set, so the reference
|
||||||
// should not throw when accessing it.
|
// should not throw when accessing it.
|
||||||
Assert.That(tyr0, Is.NotDislodged);
|
Assert.That(tyr0, Is.NotDislodged);
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ public class TimeTravelTest
|
||||||
Is.EqualTo(1),
|
Is.EqualTo(1),
|
||||||
"A failed move incorrectly forked the timeline");
|
"A failed move incorrectly forked the timeline");
|
||||||
Assert.That(s1.Futures.Count(), Is.EqualTo(1));
|
Assert.That(s1.Futures.Count(), Is.EqualTo(1));
|
||||||
Season s2 = world.GetSeason(s1.Turn + 1, s1.Timeline);
|
Season s2 = world.GetSeason(s1.Timeline, s1.Turn + 1);
|
||||||
Assert.That(s2.Futures.Count(), Is.EqualTo(0));
|
Assert.That(s2.Futures.Count(), Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public class TimeTravelTest
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
||||||
|
|
||||||
// Move, then support the past move even though it succeeded already.
|
// Move, then support the past move even though it succeeded already.
|
||||||
setup[(0, 0)]
|
setup[("a", 0)]
|
||||||
.GetReference(out Season s0)
|
.GetReference(out Season s0)
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").MovesTo("Tyr").GetReference(out var mun0)
|
.Army("Mun").MovesTo("Tyr").GetReference(out var mun0)
|
||||||
|
@ -162,7 +162,7 @@ public class TimeTravelTest
|
||||||
Assert.That(mun0, Is.Victorious);
|
Assert.That(mun0, Is.Victorious);
|
||||||
setup.UpdateWorld();
|
setup.UpdateWorld();
|
||||||
|
|
||||||
setup[(1, 0)]
|
setup[("a", 1)]
|
||||||
.GetReference(out Season s1)
|
.GetReference(out Season s1)
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Tyr").Holds()
|
.Army("Tyr").Holds()
|
||||||
|
@ -182,7 +182,7 @@ public class TimeTravelTest
|
||||||
Is.EqualTo(1),
|
Is.EqualTo(1),
|
||||||
"A superfluous support incorrectly forked the timeline");
|
"A superfluous support incorrectly forked the timeline");
|
||||||
Assert.That(s1.Futures.Count(), Is.EqualTo(1));
|
Assert.That(s1.Futures.Count(), Is.EqualTo(1));
|
||||||
Season s2 = world.GetSeason(s1.Turn + 1, s1.Timeline);
|
Season s2 = world.GetSeason(s1.Timeline, s1.Turn + 1);
|
||||||
Assert.That(s2.Futures.Count(), Is.EqualTo(0));
|
Assert.That(s2.Futures.Count(), Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,51 +192,51 @@ public class TimeTravelTest
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
||||||
|
|
||||||
// London creates two timelines by moving into the past.
|
// London creates two timelines by moving into the past.
|
||||||
setup[(0, 0)]
|
setup[("a", 0)]
|
||||||
.GetReference(out var s0_0)
|
.GetReference(out var a0)
|
||||||
["England"].Army("Lon").Holds()
|
["England"].Army("Lon").Holds()
|
||||||
["Austria"].Army("Tyr").Holds()
|
["Austria"].Army("Tyr").Holds()
|
||||||
["Germany"].Army("Mun").Holds()
|
["Germany"].Army("Mun").Holds()
|
||||||
.Execute()
|
.Execute()
|
||||||
[(1, 0)]
|
[("a", 1)]
|
||||||
["England"].Army("Lon").MovesTo("Yor", s0_0)
|
["England"].Army("Lon").MovesTo("Yor", a0)
|
||||||
.Execute()
|
.Execute()
|
||||||
// Head seasons: 2:0 1:1
|
// Head seasons: a2 b1
|
||||||
// Both contain copies of the armies in Mun and Tyr.
|
// Both contain copies of the armies in Mun and Tyr.
|
||||||
// Now Germany dislodges Austria in Tyr by supporting the move across timelines.
|
// Now Germany dislodges Austria in Tyr by supporting the move across timelines.
|
||||||
[(2, 0)]
|
[("a", 2)]
|
||||||
.GetReference(out var s2_0)
|
.GetReference(out var a2)
|
||||||
["Germany"].Army("Mun").MovesTo("Tyr").GetReference(out var mun2_0)
|
["Germany"].Army("Mun").MovesTo("Tyr").GetReference(out var mun_a2)
|
||||||
["Austria"].Army("Tyr").Holds().GetReference(out var tyr2_0)
|
["Austria"].Army("Tyr").Holds().GetReference(out var tyr_a2)
|
||||||
[(1, 1)]
|
[("b", 1)]
|
||||||
.GetReference(out var s1_1)
|
.GetReference(out var b1)
|
||||||
["Germany"].Army("Mun").Supports.Army("Mun", s2_0).MoveTo("Tyr").GetReference(out var mun1_1)
|
["Germany"].Army("Mun").Supports.Army("Mun", a2).MoveTo("Tyr").GetReference(out var mun_b1)
|
||||||
["Austria"].Army("Tyr").Holds();
|
["Austria"].Army("Tyr").Holds();
|
||||||
|
|
||||||
// The attack against Tyr 2:0 succeeds.
|
// The attack against Tyr a2 succeeds.
|
||||||
setup.ValidateOrders();
|
setup.ValidateOrders();
|
||||||
Assert.That(mun2_0, Is.Valid);
|
Assert.That(mun_a2, Is.Valid);
|
||||||
Assert.That(tyr2_0, Is.Valid);
|
Assert.That(tyr_a2, Is.Valid);
|
||||||
Assert.That(mun1_1, Is.Valid);
|
Assert.That(mun_b1, Is.Valid);
|
||||||
setup.AdjudicateOrders();
|
setup.AdjudicateOrders();
|
||||||
Assert.That(mun2_0, Is.Victorious);
|
Assert.That(mun_a2, Is.Victorious);
|
||||||
Assert.That(tyr2_0, Is.Dislodged);
|
Assert.That(tyr_a2, Is.Dislodged);
|
||||||
Assert.That(mun1_1, Is.NotCut);
|
Assert.That(mun_b1, Is.NotCut);
|
||||||
|
|
||||||
// Since both seasons were at the head of their timelines, there should be no forking.
|
// Since both seasons were at the head of their timelines, there should be no forking.
|
||||||
World world = setup.UpdateWorld();
|
World world = setup.UpdateWorld();
|
||||||
Assert.That(
|
Assert.That(
|
||||||
s2_0.Futures.Count(),
|
a2.Futures.Count(),
|
||||||
Is.EqualTo(1),
|
Is.EqualTo(1),
|
||||||
"A cross-timeline support incorrectly forked the head of the timeline");
|
"A cross-timeline support incorrectly forked the head of the timeline");
|
||||||
Assert.That(
|
Assert.That(
|
||||||
s1_1.Futures.Count(),
|
b1.Futures.Count(),
|
||||||
Is.EqualTo(1),
|
Is.EqualTo(1),
|
||||||
"A cross-timeline support incorrectly forked the head of the timeline");
|
"A cross-timeline support incorrectly forked the head of the timeline");
|
||||||
Season s3_0 = world.GetSeason(s2_0.Turn + 1, s2_0.Timeline);
|
Season a3 = world.GetSeason(a2.Timeline, a2.Turn + 1);
|
||||||
Assert.That(s3_0.Futures.Count(), Is.EqualTo(0));
|
Assert.That(a3.Futures.Count(), Is.EqualTo(0));
|
||||||
Season s2_1 = world.GetSeason(s1_1.Turn + 1, s1_1.Timeline);
|
Season b2 = world.GetSeason(b1.Timeline, b1.Turn + 1);
|
||||||
Assert.That(s2_1.Futures.Count(), Is.EqualTo(0));
|
Assert.That(b2.Futures.Count(), Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -245,63 +245,63 @@ public class TimeTravelTest
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
||||||
|
|
||||||
// As above, only now London creates three timelines.
|
// As above, only now London creates three timelines.
|
||||||
setup[(0, 0)]
|
setup[("a", 0)]
|
||||||
.GetReference(out var s0_0)
|
.GetReference(out var a0)
|
||||||
["England"].Army("Lon").Holds()
|
["England"].Army("Lon").Holds()
|
||||||
["Austria"].Army("Boh").Holds()
|
["Austria"].Army("Boh").Holds()
|
||||||
["Germany"].Army("Mun").Holds()
|
["Germany"].Army("Mun").Holds()
|
||||||
.Execute()
|
.Execute()
|
||||||
[(1, 0)]
|
[("a", 1)]
|
||||||
["England"].Army("Lon").MovesTo("Yor", s0_0)
|
["England"].Army("Lon").MovesTo("Yor", a0)
|
||||||
.Execute()
|
.Execute()
|
||||||
// Head seasons: 2:0 1:1
|
// Head seasons: a2, b1
|
||||||
[(2, 0)]
|
[("a", 2)]
|
||||||
[(1, 1)]
|
[("b", 1)]
|
||||||
["England"].Army("Yor").MovesTo("Edi", s0_0)
|
["England"].Army("Yor").MovesTo("Edi", a0)
|
||||||
.Execute()
|
.Execute()
|
||||||
// Head seasons: 3:0 2:1 1:2
|
// Head seasons: a3, b2, c1
|
||||||
// All three of these contain copies of the armies in Mun and Tyr.
|
// All three of these contain copies of the armies in Mun and Tyr.
|
||||||
// As above, Germany dislodges Austria in Tyr 3:0 by supporting the move from 2:1.
|
// As above, Germany dislodges Austria in Tyr a3 by supporting the move from b2.
|
||||||
[(3, 0)]
|
[("a", 3)]
|
||||||
.GetReference(out var s3_0)
|
.GetReference(out var a3)
|
||||||
["Germany"].Army("Mun").MovesTo("Tyr")
|
["Germany"].Army("Mun").MovesTo("Tyr")
|
||||||
["Austria"].Army("Tyr").Holds()
|
["Austria"].Army("Tyr").Holds()
|
||||||
[(2, 1)]
|
[("b", 2)]
|
||||||
.GetReference(out Season s2_1)
|
.GetReference(out Season b2)
|
||||||
["Germany"].Army("Mun").Supports.Army("Mun", s3_0).MoveTo("Tyr").GetReference(out var mun2_1)
|
["Germany"].Army("Mun").Supports.Army("Mun", a3).MoveTo("Tyr").GetReference(out var mun_b2)
|
||||||
["Austria"].Army("Tyr").Holds()
|
["Austria"].Army("Tyr").Holds()
|
||||||
[(1, 2)]
|
[("c", 1)]
|
||||||
["Germany"].Army("Mun").Holds()
|
["Germany"].Army("Mun").Holds()
|
||||||
["Austria"].Army("Tyr").Holds()
|
["Austria"].Army("Tyr").Holds()
|
||||||
.Execute()
|
.Execute()
|
||||||
// Head seasons: 4:0 3:1 2:2
|
// Head seasons: a4, b3, c2
|
||||||
// Now Austria cuts the support in 2:1 by attacking from 2:2.
|
// Now Austria cuts the support in b2 by attacking from c2.
|
||||||
[(4, 0)]
|
[("a", 4)]
|
||||||
["Germany"].Army("Tyr").Holds()
|
["Germany"].Army("Tyr").Holds()
|
||||||
[(3, 1)]
|
[("b", 3)]
|
||||||
["Germany"].Army("Mun").Holds()
|
["Germany"].Army("Mun").Holds()
|
||||||
["Austria"].Army("Tyr").Holds()
|
["Austria"].Army("Tyr").Holds()
|
||||||
[(2, 2)]
|
[("c", 2)]
|
||||||
["Germany"].Army("Mun").Holds()
|
["Germany"].Army("Mun").Holds()
|
||||||
["Austria"].Army("Tyr").MovesTo("Mun", s2_1).GetReference(out var tyr2_2);
|
["Austria"].Army("Tyr").MovesTo("Mun", b2).GetReference(out var tyr_c2);
|
||||||
|
|
||||||
// The attack on Mun 2:1 is repelled, but the support is cut.
|
// The attack on Mun b2 is repelled, but the support is cut.
|
||||||
setup.ValidateOrders();
|
setup.ValidateOrders();
|
||||||
Assert.That(tyr2_2, Is.Valid);
|
Assert.That(tyr_c2, Is.Valid);
|
||||||
setup.AdjudicateOrders();
|
setup.AdjudicateOrders();
|
||||||
Assert.That(tyr2_2, Is.Repelled);
|
Assert.That(tyr_c2, Is.Repelled);
|
||||||
Assert.That(mun2_1, Is.NotDislodged);
|
Assert.That(mun_b2, Is.NotDislodged);
|
||||||
Assert.That(mun2_1, Is.Cut);
|
Assert.That(mun_b2, Is.Cut);
|
||||||
|
|
||||||
// Though the support was cut, the timeline doesn't fork because the outcome of a battle
|
// Though the support was cut, the timeline doesn't fork because the outcome of a battle
|
||||||
// wasn't changed in this timeline.
|
// wasn't changed in this timeline.
|
||||||
World world = setup.UpdateWorld();
|
World world = setup.UpdateWorld();
|
||||||
Assert.That(
|
Assert.That(
|
||||||
s3_0.Futures.Count(),
|
a3.Futures.Count(),
|
||||||
Is.EqualTo(1),
|
Is.EqualTo(1),
|
||||||
"A cross-timeline support cut incorrectly forked the timeline");
|
"A cross-timeline support cut incorrectly forked the timeline");
|
||||||
Assert.That(
|
Assert.That(
|
||||||
s2_1.Futures.Count(),
|
b2.Futures.Count(),
|
||||||
Is.EqualTo(1),
|
Is.EqualTo(1),
|
||||||
"A cross-timeline support cut incorrectly forked the timeline");
|
"A cross-timeline support cut incorrectly forked the timeline");
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class MovementAdjudicatorTest
|
||||||
public void Update_DoubleHold()
|
public void Update_DoubleHold()
|
||||||
{
|
{
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
||||||
setup[(0, 0)]
|
setup[("a", 0)]
|
||||||
.GetReference(out Season s1)
|
.GetReference(out Season s1)
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").Holds().GetReference(out var mun1);
|
.Army("Mun").Holds().GetReference(out var mun1);
|
||||||
|
@ -199,7 +199,7 @@ public class MovementAdjudicatorTest
|
||||||
World updated = setup.UpdateWorld();
|
World updated = setup.UpdateWorld();
|
||||||
|
|
||||||
// Confirm the future was created
|
// Confirm the future was created
|
||||||
Season s2 = updated.GetSeason(1, 0);
|
Season s2 = updated.GetSeason("a", 1);
|
||||||
Assert.That(s2.Past, Is.EqualTo(s1));
|
Assert.That(s2.Past, Is.EqualTo(s1));
|
||||||
Assert.That(s2.Futures, Is.Empty);
|
Assert.That(s2.Futures, Is.Empty);
|
||||||
Assert.That(s2.Timeline, Is.EqualTo(s1.Timeline));
|
Assert.That(s2.Timeline, Is.EqualTo(s1.Timeline));
|
||||||
|
@ -212,7 +212,7 @@ public class MovementAdjudicatorTest
|
||||||
Assert.That(u2.Past, Is.EqualTo(mun1.Order.Unit));
|
Assert.That(u2.Past, Is.EqualTo(mun1.Order.Unit));
|
||||||
Assert.That(u2.Season, Is.EqualTo(s2));
|
Assert.That(u2.Season, Is.EqualTo(s2));
|
||||||
|
|
||||||
setup[(1, 0)]
|
setup[("a", 1)]
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").Holds().GetReference(out var mun2);
|
.Army("Mun").Holds().GetReference(out var mun2);
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public class MovementAdjudicatorTest
|
||||||
|
|
||||||
// Update the world again
|
// Update the world again
|
||||||
updated = setup.UpdateWorld();
|
updated = setup.UpdateWorld();
|
||||||
Season s3 = updated.GetSeason(s2.Turn + 1, s2.Timeline);
|
Season s3 = updated.GetSeason(s2.Timeline, s2.Turn + 1);
|
||||||
Unit u3 = updated.GetUnitAt("Mun", s3.Coord);
|
Unit u3 = updated.GetUnitAt("Mun", s3.Coord);
|
||||||
Assert.That(u3.Past, Is.EqualTo(mun2.Order.Unit));
|
Assert.That(u3.Past, Is.EqualTo(mun2.Order.Unit));
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ public class MovementAdjudicatorTest
|
||||||
public void Update_DoubleMove()
|
public void Update_DoubleMove()
|
||||||
{
|
{
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
TestCaseBuilder setup = new(World.WithStandardMap(), MovementPhaseAdjudicator.Instance);
|
||||||
setup[(0, 0)]
|
setup[("a", 0)]
|
||||||
.GetReference(out Season s1)
|
.GetReference(out Season s1)
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Mun").MovesTo("Tyr").GetReference(out var mun1);
|
.Army("Mun").MovesTo("Tyr").GetReference(out var mun1);
|
||||||
|
@ -249,7 +249,7 @@ public class MovementAdjudicatorTest
|
||||||
World updated = setup.UpdateWorld();
|
World updated = setup.UpdateWorld();
|
||||||
|
|
||||||
// Confirm the future was created
|
// Confirm the future was created
|
||||||
Season s2 = updated.GetSeason(s1.Turn + 1, s1.Timeline);
|
Season s2 = updated.GetSeason(s1.Timeline, s1.Turn + 1);
|
||||||
Assert.That(s2.Past, Is.EqualTo(s1));
|
Assert.That(s2.Past, Is.EqualTo(s1));
|
||||||
Assert.That(s2.Futures, Is.Empty);
|
Assert.That(s2.Futures, Is.Empty);
|
||||||
Assert.That(s2.Timeline, Is.EqualTo(s1.Timeline));
|
Assert.That(s2.Timeline, Is.EqualTo(s1.Timeline));
|
||||||
|
@ -262,7 +262,7 @@ public class MovementAdjudicatorTest
|
||||||
Assert.That(u2.Past, Is.EqualTo(mun1.Order.Unit));
|
Assert.That(u2.Past, Is.EqualTo(mun1.Order.Unit));
|
||||||
Assert.That(u2.Season, Is.EqualTo(s2));
|
Assert.That(u2.Season, Is.EqualTo(s2));
|
||||||
|
|
||||||
setup[(1, 0)]
|
setup[("a", 1)]
|
||||||
["Germany"]
|
["Germany"]
|
||||||
.Army("Tyr").MovesTo("Mun").GetReference(out var tyr2);
|
.Army("Tyr").MovesTo("Mun").GetReference(out var tyr2);
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ public class MovementAdjudicatorTest
|
||||||
|
|
||||||
// Update the world again
|
// Update the world again
|
||||||
updated = setup.UpdateWorld();
|
updated = setup.UpdateWorld();
|
||||||
Season s3 = updated.GetSeason(s2.Turn + 1, s2.Timeline);
|
Season s3 = updated.GetSeason(s2.Timeline, s2.Turn + 1);
|
||||||
Unit u3 = updated.GetUnitAt("Mun", s3.Coord);
|
Unit u3 = updated.GetUnitAt("Mun", s3.Coord);
|
||||||
Assert.That(u3.Past, Is.EqualTo(u2));
|
Assert.That(u3.Past, Is.EqualTo(u2));
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,14 @@ public class SeasonTests
|
||||||
Season c1 = a1.MakeFork();
|
Season c1 = a1.MakeFork();
|
||||||
Season d1 = a2.MakeFork();
|
Season d1 = a2.MakeFork();
|
||||||
|
|
||||||
Assert.That(a0.Timeline, Is.EqualTo(0), "Unexpected trunk timeline number");
|
Assert.That(a0.Timeline, Is.EqualTo("a"), "Unexpected trunk timeline");
|
||||||
Assert.That(a1.Timeline, Is.EqualTo(0), "Unexpected trunk timeline number");
|
Assert.That(a1.Timeline, Is.EqualTo("a"), "Unexpected trunk timeline");
|
||||||
Assert.That(a2.Timeline, Is.EqualTo(0), "Unexpected trunk timeline number");
|
Assert.That(a2.Timeline, Is.EqualTo("a"), "Unexpected trunk timeline");
|
||||||
Assert.That(a3.Timeline, Is.EqualTo(0), "Unexpected trunk timeline number");
|
Assert.That(a3.Timeline, Is.EqualTo("a"), "Unexpected trunk timeline");
|
||||||
Assert.That(b1.Timeline, Is.EqualTo(1), "Unexpected first alt number");
|
Assert.That(b1.Timeline, Is.EqualTo("b"), "Unexpected first alt");
|
||||||
Assert.That(b2.Timeline, Is.EqualTo(1), "Unexpected first alt number");
|
Assert.That(b2.Timeline, Is.EqualTo("b"), "Unexpected first alt");
|
||||||
Assert.That(c1.Timeline, Is.EqualTo(2), "Unexpected second alt number");
|
Assert.That(c1.Timeline, Is.EqualTo("c"), "Unexpected second alt");
|
||||||
Assert.That(d1.Timeline, Is.EqualTo(3), "Unexpected third alt number");
|
Assert.That(d1.Timeline, Is.EqualTo("d"), "Unexpected third alt");
|
||||||
|
|
||||||
Assert.That(a0.Turn, Is.EqualTo(Season.FIRST_TURN + 0), "Unexpected first turn number");
|
Assert.That(a0.Turn, Is.EqualTo(Season.FIRST_TURN + 0), "Unexpected first turn number");
|
||||||
Assert.That(a1.Turn, Is.EqualTo(Season.FIRST_TURN + 1), "Unexpected next turn number");
|
Assert.That(a1.Turn, Is.EqualTo(Season.FIRST_TURN + 1), "Unexpected next turn number");
|
||||||
|
@ -57,9 +57,9 @@ public class SeasonTests
|
||||||
Season s4 = s2.MakeFork();
|
Season s4 = s2.MakeFork();
|
||||||
World updated = world.Update(seasons: world.Seasons.Append(s2).Append(s3).Append(s4));
|
World updated = world.Update(seasons: world.Seasons.Append(s2).Append(s3).Append(s4));
|
||||||
|
|
||||||
Assert.That(updated.GetSeason(Season.FIRST_TURN, 0), Is.EqualTo(updated.RootSeason));
|
Assert.That(updated.GetSeason("a", Season.FIRST_TURN), Is.EqualTo(updated.RootSeason));
|
||||||
Assert.That(updated.GetSeason(Season.FIRST_TURN + 1, 0), Is.EqualTo(s2));
|
Assert.That(updated.GetSeason("a", Season.FIRST_TURN + 1), Is.EqualTo(s2));
|
||||||
Assert.That(updated.GetSeason(Season.FIRST_TURN + 2, 0), Is.EqualTo(s3));
|
Assert.That(updated.GetSeason("a", Season.FIRST_TURN + 2), Is.EqualTo(s3));
|
||||||
Assert.That(updated.GetSeason(Season.FIRST_TURN + 2, 1), Is.EqualTo(s4));
|
Assert.That(updated.GetSeason("b", Season.FIRST_TURN + 2), Is.EqualTo(s4));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,7 +19,7 @@ public class TestCaseBuilder
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Choose a new season to define orders for.
|
/// Choose a new season to define orders for.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ISeasonContext this[(int turn, int timeline) seasonCoord] { get; }
|
public ISeasonContext this[(string timeline, int turn) seasonCoord] { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the context for defining the orders for a power.
|
/// Get the context for defining the orders for a power.
|
||||||
|
@ -40,7 +40,7 @@ public class TestCaseBuilder
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Choose a new season to define orders for.
|
/// Choose a new season to define orders for.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ISeasonContext this[(int turn, int timeline) seasonCoord] { get; }
|
public ISeasonContext this[(string timeline, int turn) seasonCoord] { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the context for defining the orders for another power.
|
/// Get the context for defining the orders for another power.
|
||||||
|
@ -188,7 +188,7 @@ public class TestCaseBuilder
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Choose a new season to define orders for.
|
/// Choose a new season to define orders for.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ISeasonContext this[(int turn, int timeline) seasonCoord] { get; }
|
public ISeasonContext this[(string timeline, int turn) seasonCoord] { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the context for defining the orders for another power.
|
/// Get the context for defining the orders for another power.
|
||||||
|
@ -234,13 +234,13 @@ public class TestCaseBuilder
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the context for defining the orders for a power. Defaults to the root season.
|
/// Get the context for defining the orders for a power. Defaults to the root season.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IPowerContext this[string powerName] => this[(0, 0)][powerName];
|
public IPowerContext this[string powerName] => this[("a", 0)][powerName];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the context for defining the orders for a season.
|
/// Get the context for defining the orders for a season.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ISeasonContext this[(int turn, int timeline) seasonCoord]
|
public ISeasonContext this[(string timeline, int turn) seasonCoord]
|
||||||
=> new SeasonContext(this, this.World.GetSeason(seasonCoord.turn, seasonCoord.timeline));
|
=> new SeasonContext(this, this.World.GetSeason(seasonCoord.timeline, seasonCoord.turn));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a unit matching a description. If no such unit exists, one is created and added to the
|
/// Get a unit matching a description. If no such unit exists, one is created and added to the
|
||||||
|
@ -327,8 +327,8 @@ public class TestCaseBuilder
|
||||||
this.Season = season;
|
this.Season = season;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISeasonContext this[(int turn, int timeline) seasonCoord]
|
public ISeasonContext this[(string timeline, int turn) seasonCoord]
|
||||||
=> this.Builder[(seasonCoord.turn, seasonCoord.timeline)];
|
=> this.Builder[(seasonCoord.timeline, seasonCoord.turn)];
|
||||||
|
|
||||||
public IPowerContext this[string powerName]
|
public IPowerContext this[string powerName]
|
||||||
=> new PowerContext(this, this.Builder.World.Map.GetPower(powerName));
|
=> new PowerContext(this, this.Builder.World.Map.GetPower(powerName));
|
||||||
|
@ -353,7 +353,7 @@ public class TestCaseBuilder
|
||||||
this.Power = Power;
|
this.Power = Power;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISeasonContext this[(int turn, int timeline) seasonCoord]
|
public ISeasonContext this[(string timeline, int turn) seasonCoord]
|
||||||
=> this.SeasonContext[seasonCoord];
|
=> this.SeasonContext[seasonCoord];
|
||||||
|
|
||||||
public IPowerContext this[string powerName]
|
public IPowerContext this[string powerName]
|
||||||
|
@ -623,7 +623,7 @@ public class TestCaseBuilder
|
||||||
return this.Builder;
|
return this.Builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISeasonContext this[(int turn, int timeline) seasonCoord]
|
public ISeasonContext this[(string timeline, int turn) seasonCoord]
|
||||||
=> this.SeasonContext[seasonCoord];
|
=> this.SeasonContext[seasonCoord];
|
||||||
|
|
||||||
public IPowerContext this[string powerName]
|
public IPowerContext this[string powerName]
|
||||||
|
|
|
@ -14,7 +14,7 @@ class TestCaseBuilderTest
|
||||||
{
|
{
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap());
|
TestCaseBuilder setup = new(World.WithStandardMap());
|
||||||
|
|
||||||
Assert.That(setup.World.Powers.Count(), Is.EqualTo(7), "Unexpected power count");
|
Assert.That(setup.World.Powers.Count, Is.EqualTo(7), "Unexpected power count");
|
||||||
Assert.That(setup.World.Units, Is.Empty, "Expected no units to be created yet");
|
Assert.That(setup.World.Units, Is.Empty, "Expected no units to be created yet");
|
||||||
|
|
||||||
setup
|
setup
|
||||||
|
@ -49,7 +49,7 @@ class TestCaseBuilderTest
|
||||||
{
|
{
|
||||||
TestCaseBuilder setup = new(World.WithStandardMap());
|
TestCaseBuilder setup = new(World.WithStandardMap());
|
||||||
|
|
||||||
Assert.That(setup.World.Powers.Count(), Is.EqualTo(7), "Unexpected power count");
|
Assert.That(setup.World.Powers.Count, Is.EqualTo(7), "Unexpected power count");
|
||||||
Assert.That(setup.World.Units, Is.Empty, "Expected no units to be created yet");
|
Assert.That(setup.World.Units, Is.Empty, "Expected no units to be created yet");
|
||||||
Assert.That(setup.Orders, Is.Empty, "Expected no orders to be created yet");
|
Assert.That(setup.Orders, Is.Empty, "Expected no orders to be created yet");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue