Merge remote-tracking branch 'origin/master' into eureka/aetheria-arena-command-seam-agents
This commit is contained in:
commit
b519fbd3d0
19 changed files with 778 additions and 85 deletions
32
tests/Aetheria.Shared.Tests/BeltShapes.cs
Normal file
32
tests/Aetheria.Shared.Tests/BeltShapes.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GameCult.Caching;
|
||||
|
||||
// The belt shapes a test reads back from a built zone. A swarm's or a lane's rail is a copy of its host's rail (same Parent,
|
||||
// Distance and Phase), never a slot Place laid out, so the tests that walk placed orbits leave copied rails out through this one
|
||||
// helper.
|
||||
public static class BeltShapes
|
||||
{
|
||||
public static bool CopiedRail(Zone zone, CultRecordKey orbit)
|
||||
{
|
||||
if (!zone.Planets.Values.Any(b => b is AsteroidBeltData && b.Orbit.Key.Equals(orbit))) return false;
|
||||
var rail = zone.Orbits[orbit].Data;
|
||||
return zone.Planets.Values.Where(b => !(b is AsteroidBeltData)).Select(b => zone.Orbits[b.Orbit.Key].Data)
|
||||
.Any(o => o.Parent.Key.Equals(rail.Parent.Key) && o.Distance == rail.Distance && o.Phase == rail.Phase);
|
||||
}
|
||||
|
||||
// Every laned belt with its rail and its host: a belt on a copied rail that does not ride the rail (a swarm does), whose host
|
||||
// is the body orbit the rail copies.
|
||||
public static IEnumerable<(Orbit Host, Orbit Rail, AsteroidBelt Belt)> Lanes(Zone zone)
|
||||
{
|
||||
foreach (var (key, belt) in zone.AsteroidBelts.Where(b => !b.Value.Data.RidesRail))
|
||||
{
|
||||
var railKey = zone.Planets[key].Orbit.Key;
|
||||
if (!CopiedRail(zone, railKey)) continue;
|
||||
var rail = zone.Orbits[railKey];
|
||||
var host = zone.Planets.Values.Where(b => !(b is AsteroidBeltData)).Select(b => zone.Orbits[b.Orbit.Key])
|
||||
.Single(o => o.Data.Parent.Key.Equals(rail.Data.Parent.Key) && o.Data.Distance == rail.Data.Distance && o.Data.Phase == rail.Data.Phase);
|
||||
yield return (host, rail, belt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,8 @@ public sealed class ChildrenWithinReachTests : IClassFixture<ChildrenWithinReach
|
|||
private readonly ZoneWorlds _worlds = new ZoneWorlds();
|
||||
public readonly List<(uint Seed, Zone Zone)> All = new List<(uint, Zone)>();
|
||||
public ZoneGenerationSettings Settings;
|
||||
// Every belt the generator wrote, and those it wrote with no field kind, counted before Zone's own FieldKinds.Ensure runs.
|
||||
public int Belts, UnkindedAtGeneration;
|
||||
|
||||
// Seeds 7, 11 and 12 held rings inside their heavy member's Roche margin (ring-roche-final-heavy), and seeds 10, 13, 21 and 30
|
||||
// held a bodyless ring member whose own bodies sat at their node's centre (bodyless-node-places-children); seeds 1-6 show neither.
|
||||
|
|
@ -50,6 +52,11 @@ public sealed class ChildrenWithinReachTests : IClassFixture<ChildrenWithinReach
|
|||
tune?.Invoke(Settings);
|
||||
var pack = ZoneGenerator.GenerateZone(items, Settings, planetSettings, galaxy, galaxyZone,
|
||||
galaxyZone == galaxy.Entrance && galaxy.IsPrelude, false);
|
||||
foreach (var belt in pack.Planets.Select(cache.Get).OfType<AsteroidBeltData>())
|
||||
{
|
||||
Belts++;
|
||||
if (!belt.Kind.IsSet()) UnkindedAtGeneration++;
|
||||
}
|
||||
All.Add((seed, new Zone(items, planetSettings, pack, galaxyZone, galaxy)));
|
||||
}
|
||||
}
|
||||
|
|
@ -79,16 +86,17 @@ public sealed class ChildrenWithinReachTests : IClassFixture<ChildrenWithinReach
|
|||
private static Dictionary<CultRecordKey, float> BodyMass(Zone zone) =>
|
||||
zone.Planets.Values.Where(b => !(b is AsteroidBeltData)).GroupBy(b => b.Orbit.Key).ToDictionary(g => g.Key, g => g.First().Mass);
|
||||
|
||||
// The generated orbits: every body's and its ancestors', which leaves out stations, turrets, Lagrange copies and swarm rails (a copy of the host's rail, like a Lagrange copy).
|
||||
private static HashSet<CultRecordKey> Placed(Zone zone)
|
||||
// The generated orbits: every body's and its ancestors', which leaves out stations, turrets, Lagrange copies and the copied
|
||||
// rails swarms and lanes ride (a copy of the host's rail, like a Lagrange copy; BeltShapes.CopiedRail).
|
||||
internal static HashSet<CultRecordKey> Placed(Zone zone)
|
||||
{
|
||||
var placed = new HashSet<CultRecordKey>();
|
||||
foreach (var body in zone.Planets.Values.Where(b => !(b is AsteroidBeltData { RidesRail: true })))
|
||||
foreach (var body in zone.Planets.Values.Where(b => !BeltShapes.CopiedRail(zone, b.Orbit.Key)))
|
||||
for (var key = body.Orbit.Key; placed.Add(key) && zone.Orbits[key].Data.Parent.IsSet();) key = zone.Orbits[key].Data.Parent.Key;
|
||||
return placed;
|
||||
}
|
||||
|
||||
private static List<CultRecordKey> ChildrenOf(Zone zone, CultRecordKey parent, HashSet<CultRecordKey> placed) =>
|
||||
internal static List<CultRecordKey> ChildrenOf(Zone zone, CultRecordKey parent, HashSet<CultRecordKey> placed) =>
|
||||
placed.Where(k => zone.Orbits[k].Data.Parent.IsSet() && zone.Orbits[k].Data.Parent.Key.Equals(parent))
|
||||
.OrderBy(k => zone.Orbits[k].Data.Distance).ToList();
|
||||
|
||||
|
|
@ -332,7 +340,7 @@ public sealed class ChildrenWithinReachTests : IClassFixture<ChildrenWithinReach
|
|||
foreach (var (seed, zone) in _zones.All)
|
||||
{
|
||||
var mass = BodyMass(zone);
|
||||
foreach (var (beltKey, belt) in zone.AsteroidBelts.Where(b => !b.Value.Data.RidesRail))
|
||||
foreach (var (beltKey, belt) in zone.AsteroidBelts.Where(b => !BeltShapes.CopiedRail(zone, zone.Planets[b.Key].Orbit.Key)))
|
||||
{
|
||||
belts++;
|
||||
var orbit = zone.Planets[beltKey].Orbit.Key;
|
||||
|
|
@ -363,7 +371,7 @@ public sealed class ChildrenWithinReachTests : IClassFixture<ChildrenWithinReach
|
|||
// authored width (ruling belt-fills-its-slot): it sits at the slot's midpoint where the test can spell both edges, and
|
||||
// none collapses to a line (finding belts-collapse-to-a-line). Rocks are scattered inside the belt's half width, so their
|
||||
// spread is at most the belt's width; a belt beside another belt has an edge only the generator knows, and is checked
|
||||
// against the weaker bound.
|
||||
// against the weaker bound (two adjacent belts' spacing is pinned by AdjacentBeltsKeepTheirSpacing).
|
||||
[Fact]
|
||||
public void BeltsFillTheirSlots()
|
||||
{
|
||||
|
|
@ -374,7 +382,7 @@ public sealed class ChildrenWithinReachTests : IClassFixture<ChildrenWithinReach
|
|||
{
|
||||
var mass = BodyMass(zone);
|
||||
var placed = Placed(zone);
|
||||
var beltAt = zone.AsteroidBelts.Where(b => !b.Value.Data.RidesRail).ToDictionary(b => zone.Planets[b.Key].Orbit.Key, b => b.Value.Data.Asteroids);
|
||||
var beltAt = zone.AsteroidBelts.Where(b => !BeltShapes.CopiedRail(zone, zone.Planets[b.Key].Orbit.Key)).ToDictionary(b => zone.Planets[b.Key].Orbit.Key, b => b.Value.Data.Asteroids);
|
||||
foreach (var (orbit, rocks) in beltAt)
|
||||
{
|
||||
var parent = zone.Orbits[orbit].Data.Parent.Key;
|
||||
|
|
@ -424,7 +432,7 @@ public sealed class ChildrenWithinReachTests : IClassFixture<ChildrenWithinReach
|
|||
{ Exponent = authored.Exponent, Multiplier = authored.Multiplier * .02f, Constant = authored.Constant * .02f });
|
||||
int belts = 0, filled = 0;
|
||||
foreach (var (seed, zone) in narrow.All)
|
||||
foreach (var (key, belt) in zone.AsteroidBelts.Where(b => !b.Value.Data.RidesRail))
|
||||
foreach (var (key, belt) in zone.AsteroidBelts.Where(b => !BeltShapes.CopiedRail(zone, zone.Planets[b.Key].Orbit.Key)))
|
||||
{
|
||||
var rocks = belt.Data.Asteroids;
|
||||
if (rocks.Length < 2) continue;
|
||||
|
|
@ -438,14 +446,41 @@ public sealed class ChildrenWithinReachTests : IClassFixture<ChildrenWithinReach
|
|||
Assert.True(filled >= 10, $"only {filled} of {belts} belts fill the authored width");
|
||||
}
|
||||
|
||||
private static GeneratorPlanet Body(GeneratorPlanet parent, float mass, float phase = 0, bool ring = false)
|
||||
internal static GeneratorPlanet Body(GeneratorPlanet parent, float mass, float phase = 0, bool ring = false)
|
||||
{
|
||||
var node = new GeneratorPlanet { Parent = parent, Mass = mass, Phase = phase, Ring = ring };
|
||||
parent.Children.Add(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
private static PlanetSettings AuthoredPlanetSettings() => AuthoredSettings.Load(RunStartTests.FindRepoRoot()).Read<PlanetSettings>("PlanetSettings");
|
||||
internal static PlanetSettings AuthoredPlanetSettings() => AuthoredSettings.Load(RunStartTests.FindRepoRoot()).Read<PlanetSettings>("PlanetSettings");
|
||||
|
||||
// Two belts side by side under one parent (production never draws them; follow-up belt-after-belt-edge-pin): the second
|
||||
// belt's slot starts a sibling spacing outside the first belt's outer edge, not its rail, so their rock intervals keep a spacing.
|
||||
[Fact]
|
||||
public void AdjacentBeltsKeepTheirSpacing()
|
||||
{
|
||||
var settings = AuthoredSettings.Load(RunStartTests.FindRepoRoot()).Read<ZoneGenerationSettings>("ZoneSettings");
|
||||
// Wider than any slot, so each belt fills its slot and the second's inner edge is the slot's inner bound.
|
||||
settings.AsteroidBeltWidth = new ExponentialCurve { Exponent = 1f, Multiplier = 0f, Constant = 1e7f };
|
||||
var root = new GeneratorPlanet { Mass = 1e5f };
|
||||
Body(root, 100f);
|
||||
var first = Body(root, 0f);
|
||||
var second = Body(root, 0f);
|
||||
Body(root, 100f, .5f);
|
||||
foreach (var belt in new[] { first, second }) { belt.Belt = true; belt.Settings = settings; }
|
||||
ZoneGenerator.Place(root, AuthoredPlanetSettings(), 1e6f, float.PositiveInfinity);
|
||||
Assert.True(root.Children.Contains(first) && root.Children.Contains(second), "a belt folded");
|
||||
Assert.True(first.Distance < second.Distance, "the belts swapped order");
|
||||
Assert.True(first.BeltHalfWidth > 0 && second.BeltHalfWidth > 0, "a belt collapsed to a line");
|
||||
var q = 1 / (1 - GravityField.Reach / 2);
|
||||
var firstOuter = first.Distance + first.BeltHalfWidth;
|
||||
var secondInner = second.Distance - second.BeltHalfWidth;
|
||||
_out.WriteLine($"first {first.Distance} +- {first.BeltHalfWidth}, second {second.Distance} +- {second.BeltHalfWidth}");
|
||||
Assert.True(firstOuter * q <= secondInner * (1 + 1e-4f), $"the second belt's inner edge {secondInner} is within a spacing of the first's outer edge {firstOuter}");
|
||||
// The slot Place records for the second belt starts at that edge (Place is the only writer of a slot).
|
||||
Assert.True(Math.Abs(second.SlotInner - firstOuter * q) <= 1e-4f * second.SlotInner, $"the second belt's slot starts at {second.SlotInner}, not {firstOuter * q}");
|
||||
}
|
||||
|
||||
// A rosette's ring round a root with no reach limit of its own sits at half the root's 0.75 x radius window, 3/8 of the radius.
|
||||
[Fact]
|
||||
|
|
|
|||
220
tests/Aetheria.Shared.Tests/LanedBeltTests.cs
Normal file
220
tests/Aetheria.Shared.Tests/LanedBeltTests.cs
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using GameCult.Caching;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
// Laned belts (rulings belt-shapes-direction, lanes-two-sided-visual-margin, lane-narrow, lane-not-outermost; map B60): a belt
|
||||
// candidate that kept its body and is not its parent's outermost child carries an annulus on a copy of its rail that fills the
|
||||
// body's slot less a lane LaneBodyRadii (1.5) body radii a side, with rocks on both sides; it is drawn from a stream of its own and
|
||||
// sits inside the slot, so it moves nothing else in the zone. Seeds 1-6, authored settings, against the same seeds drawing no lane.
|
||||
public sealed class LanedBeltTests : IClassFixture<LanedBeltTests.Samples>
|
||||
{
|
||||
private const uint First = 1, Last = 6;
|
||||
private const float Tolerance = 1e-3f;
|
||||
|
||||
public sealed class Samples : IDisposable
|
||||
{
|
||||
public readonly ChildrenWithinReachTests.Zones Authored = new ChildrenWithinReachTests.Zones(First, Last, null);
|
||||
public readonly ChildrenWithinReachTests.Zones Laneless = new ChildrenWithinReachTests.Zones(First, Last, z => z.LaneProbability = 0);
|
||||
// Every candidate tried for a lane and every eligible host given a swarm, seeds 1-30: the authored sample holds no lane
|
||||
// candidate that is a swarm host or shares a parent with another eligible host, so only this one reaches the swarm-host and
|
||||
// one-shape-per-parent filters (finding lane-filters-unexercised).
|
||||
public readonly ChildrenWithinReachTests.Zones Tuned = new ChildrenWithinReachTests.Zones(1, 30, z => { z.LaneProbability = 1; z.TrojanProbability = 1; });
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Authored.Dispose();
|
||||
Laneless.Dispose();
|
||||
Tuned.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Samples _samples;
|
||||
private readonly ITestOutputHelper _out;
|
||||
|
||||
public LanedBeltTests(Samples samples, ITestOutputHelper output)
|
||||
{
|
||||
_samples = samples;
|
||||
_out = output;
|
||||
}
|
||||
|
||||
private static CultRecordKey KeyOf(Zone zone, Orbit orbit) => zone.Orbits.First(o => o.Value == orbit).Key;
|
||||
|
||||
private static BodyData BodyAt(Zone zone, Orbit orbit) =>
|
||||
zone.Planets.Values.Single(b => !(b is AsteroidBeltData) && zone.Orbits[b.Orbit.Key] == orbit);
|
||||
|
||||
// The lane's half-width, spelled from the settings: LaneBodyRadii of the host's body radius.
|
||||
private float HalfWidth(Zone zone, float hostMass) => _samples.Authored.Settings.LaneBodyRadii * zone.Settings.BodyRadius.Evaluate(hostMass);
|
||||
|
||||
[Fact]
|
||||
public void ALaneMovesNothingElseInTheZone()
|
||||
{
|
||||
var a = _samples.Laneless.All;
|
||||
var b = _samples.Authored.All;
|
||||
Assert.Equal(a.Count, b.Count);
|
||||
var lanes = 0;
|
||||
for (var n = 0; n < a.Count; n++)
|
||||
{
|
||||
Assert.Equal(a[n].Seed, b[n].Seed);
|
||||
Assert.Empty(BeltShapes.Lanes(a[n].Zone));
|
||||
var zone = b[n].Zone;
|
||||
var laned = BeltShapes.Lanes(zone).ToList();
|
||||
lanes += laned.Count;
|
||||
bool SkipOrbit(CultRecordKey k) => laned.Any(l => l.Rail == zone.Orbits[k]);
|
||||
bool SkipBody(BodyData body) => laned.Any(l => l.Belt.Data == body);
|
||||
Assert.Equal(ZoneFingerprint.Of(new[] { a[n].Zone }, _ => false, _ => false, true), ZoneFingerprint.Of(new[] { zone }, SkipOrbit, SkipBody, true));
|
||||
}
|
||||
_out.WriteLine($"zones {b.Count}, lanes {lanes}");
|
||||
Assert.True(lanes > 0, $"no lane in seeds {First}-{Last}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ALaneIsEmptyAndBothSidesHoldRocks()
|
||||
{
|
||||
var s = _samples.Authored.Settings;
|
||||
var q = 1 / (1 - GravityField.Reach / 2);
|
||||
var lanes = 0;
|
||||
foreach (var (seed, zone) in _samples.Authored.All)
|
||||
{
|
||||
var placed = ChildrenWithinReachTests.Placed(zone);
|
||||
foreach (var (host, _, belt) in BeltShapes.Lanes(zone))
|
||||
{
|
||||
lanes++;
|
||||
Assert.False(belt.Data.RidesRail);
|
||||
Assert.Equal(0f, belt.Data.Mass);
|
||||
var hostMass = BodyAt(zone, host).Mass;
|
||||
var d = host.Data.Distance;
|
||||
var e = HalfWidth(zone, hostMass);
|
||||
Assert.Equal((int) s.AsteroidCount.Evaluate(hostMass * d), belt.Data.Asteroids.Length);
|
||||
|
||||
// The host's slot, spelled from its siblings, its parent's Roche margin and its parent's window.
|
||||
var parent = host.Data.Parent.Key;
|
||||
var sibling = ChildrenWithinReachTests.ChildrenOf(zone, parent, placed);
|
||||
var at = sibling.IndexOf(KeyOf(zone, host));
|
||||
Assert.True(at >= 0 && at < sibling.Count - 1, $"seed {seed}: a lane host is its parent's outermost child");
|
||||
var parentBody = zone.Planets.Values.FirstOrDefault(p => !(p is AsteroidBeltData) && p.Orbit.Key.Equals(parent));
|
||||
var roche = parentBody == null ? 0f : 1.5f * zone.Settings.RocheLimit.Evaluate(parentBody.Mass);
|
||||
var innerBound = Math.Max(roche, at > 0 ? zone.Orbits[sibling[at - 1]].Data.Distance * q : 0f);
|
||||
var grand = zone.Orbits[parent].Data.Parent;
|
||||
var window = grand.IsSet()
|
||||
? GravityField.Gamma * GravityField.Reach * zone.Orbits[parent].Data.Distance / Math.Max(GravityField.Beta, 1 + GravityField.Reach)
|
||||
: float.PositiveInfinity;
|
||||
var outerBound = Math.Min(window, zone.Orbits[sibling[at + 1]].Data.Distance / q);
|
||||
|
||||
var rocks = belt.Data.Asteroids.Select(r => r.Distance).ToList();
|
||||
var inner = rocks.Where(r => r < d).ToList();
|
||||
var outer = rocks.Where(r => r > d).ToList();
|
||||
_out.WriteLine($"seed {seed}: lane at {d} half-width {e}, slot [{innerBound}, {outerBound}], rocks {inner.Count} inside, {outer.Count} outside");
|
||||
Assert.True(rocks.All(r => Math.Abs(r - d) >= e - 1e-5f * d), $"seed {seed}: a rock sits {rocks.Min(r => Math.Abs(r - d))} from a host at {d}, inside a lane of {e}");
|
||||
Assert.True(inner.Count > 0 && outer.Count > 0, $"seed {seed}: a lane at {d} holds {inner.Count} rocks inside and {outer.Count} outside");
|
||||
Assert.True(d - e - innerBound >= e * (1 - Tolerance), $"seed {seed}: the inner band [{innerBound}, {d - e}] is narrower than the lane's half-width {e}");
|
||||
Assert.True(outerBound - d - e >= e * (1 - Tolerance), $"seed {seed}: the outer band [{d + e}, {outerBound}] is narrower than the lane's half-width {e}");
|
||||
Assert.True(inner.Min() >= innerBound * (1 - Tolerance), $"seed {seed}: a rock at {inner.Min()} reaches inside the slot's inner bound {innerBound}");
|
||||
Assert.True(outer.Max() <= outerBound * (1 + Tolerance), $"seed {seed}: a rock at {outer.Max()} reaches past the slot's outer bound {outerBound}");
|
||||
}
|
||||
}
|
||||
Assert.True(lanes > 0, $"no lane in seeds {First}-{Last}");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
public void ALaneHostIsALightBodyWithNoOtherShape(bool tuned)
|
||||
{
|
||||
var sample = tuned ? _samples.Tuned : _samples.Authored;
|
||||
var s = sample.Settings;
|
||||
int lanes = 0, lightChildlessSwarmHosts = 0;
|
||||
foreach (var (seed, zone) in sample.All)
|
||||
{
|
||||
// A swarm host light enough and childless enough to be a lane host: the case the swarm-host filter refuses.
|
||||
foreach (var rail in zone.AsteroidBelts.Where(b => b.Value.Data.RidesRail).Select(b => zone.Orbits[zone.Planets[b.Key].Orbit.Key].Data))
|
||||
{
|
||||
var hostBody = zone.Planets.Values.Where(b => !(b is AsteroidBeltData)).FirstOrDefault(b => zone.Orbits[b.Orbit.Key].Data is var o
|
||||
&& o.Parent.Key.Equals(rail.Parent.Key) && o.Distance == rail.Distance && o.Phase == rail.Phase);
|
||||
if (hostBody != null && hostBody.Mass < s.BeltMassCeiling
|
||||
&& !zone.Orbits.Values.Any(o => o.Data.Parent.IsSet() && o.Data.Parent.Key.Equals(hostBody.Orbit.Key)))
|
||||
lightChildlessSwarmHosts++;
|
||||
}
|
||||
var laned = BeltShapes.Lanes(zone).ToList();
|
||||
foreach (var (host, _, _) in laned)
|
||||
{
|
||||
lanes++;
|
||||
var body = BodyAt(zone, host);
|
||||
Assert.True(body.GetType() == typeof(PlanetData) && body.Mass < s.BeltMassCeiling, $"seed {seed}: a lane host is a {body.GetType().Name} of mass {body.Mass}");
|
||||
var key = KeyOf(zone, host);
|
||||
Assert.DoesNotContain(zone.Orbits.Values, o => o.Data.Parent.IsSet() && o.Data.Parent.Key.Equals(key));
|
||||
// A swarm's rail is a copy of its host's too: no lane host carries one.
|
||||
Assert.DoesNotContain(zone.AsteroidBelts.Where(b => b.Value.Data.RidesRail).Select(b => zone.Orbits[zone.Planets[b.Key].Orbit.Key].Data),
|
||||
r => r.Parent.Key.Equals(host.Data.Parent.Key) && r.Distance == host.Data.Distance && r.Phase == host.Data.Phase);
|
||||
}
|
||||
// One belt shape per parent: an annulus (a belt on a placed slot) or a lane, never both, never two lanes.
|
||||
var annuli = zone.AsteroidBelts.Keys.Select(k => zone.Planets[k].Orbit.Key).Where(o => !BeltShapes.CopiedRail(zone, o))
|
||||
.Select(o => zone.Orbits[o].Data.Parent.Key);
|
||||
var doubled = annuli.Concat(laned.Select(l => l.Host.Data.Parent.Key)).GroupBy(p => p).Count(g => g.Count() > 1);
|
||||
Assert.True(doubled == 0, $"seed {seed}: {doubled} parents carry two belt shapes");
|
||||
}
|
||||
_out.WriteLine($"zones {sample.All.Count}, lanes {lanes}, light childless swarm hosts {lightChildlessSwarmHosts}");
|
||||
Assert.True(lanes > 0, "no lane in the sample");
|
||||
if (tuned) Assert.True(lightChildlessSwarmHosts > 100, $"only {lightChildlessSwarmHosts} light childless swarm hosts: the swarm-host filter is not reached");
|
||||
}
|
||||
|
||||
// LaneRocks puts each rock in a band by the band's area (ruling lanes-two-sided-visual-margin, map B60), not half and half and
|
||||
// not by width (finding lane-split-unpinned). A lopsided slot, inner band [10, 18] (area 224) and outer [22, 24] (area 92):
|
||||
// area share 0.709, width share 0.8, half 0.5. Over 4000 rocks one sigma of the share is 0.0072, so the area share sits within
|
||||
// 4 sigma and the other two lie past 12.
|
||||
[Fact]
|
||||
public void ALaneSplitsItsRocksByBandArea()
|
||||
{
|
||||
const float inner = 10f, distance = 20f, lane = 2f, outer = 24f;
|
||||
var settings = _samples.Authored.Settings;
|
||||
var p = (18.0 * 18 - 10 * 10) / (18.0 * 18 - 10 * 10 + 24 * 24 - 22 * 22);
|
||||
int n = 0, k = 0;
|
||||
for (uint draw = 1; n < 4000; draw++)
|
||||
{
|
||||
var random = new CultMath.Random(draw);
|
||||
var rocks = ZoneGenerator.LaneRocks(settings, ref random, 1f, distance, lane, inner, outer);
|
||||
Assert.NotEmpty(rocks);
|
||||
foreach (var rock in rocks)
|
||||
{
|
||||
Assert.True(rock.Distance >= inner && rock.Distance <= distance - lane || rock.Distance >= distance + lane && rock.Distance <= outer,
|
||||
$"a rock at {rock.Distance} sits outside both bands");
|
||||
n++;
|
||||
if (rock.Distance < distance) k++;
|
||||
}
|
||||
}
|
||||
var z = (k - n * p) / Math.Sqrt(n * p * (1 - p));
|
||||
_out.WriteLine($"rocks {n}, inner {k}, area share {p:F3}, measured {(double) k / n:F3}, z {z:F2}");
|
||||
Assert.True(Math.Abs(z) < 4, $"{k} of {n} rocks in the inner band, {(double) k / n:F3} against an area share of {p:F3} (z {z:F2})");
|
||||
}
|
||||
|
||||
// An only child is its parent's outermost (ruling lane-not-outermost): Place stretches nothing for it, so its slot runs out to
|
||||
// the window and has room for a lane on both sides, yet its lane's outer band would sit past every sibling's extent and raise
|
||||
// the parent's support. The host filter refuses it on that ground alone.
|
||||
[Fact]
|
||||
public void AnOnlyChildHostsNoLane()
|
||||
{
|
||||
var root = new GeneratorPlanet { Mass = 1e5f };
|
||||
var child = ChildrenWithinReachTests.Body(root, 10f);
|
||||
var planetSettings = ChildrenWithinReachTests.AuthoredPlanetSettings();
|
||||
ZoneGenerator.Place(root, planetSettings, 1e6f, 1e5f);
|
||||
var lane = _samples.Authored.Settings.LaneBodyRadii * planetSettings.BodyRadius.Evaluate(child.Mass);
|
||||
_out.WriteLine($"only child at {child.Distance}, slot [{child.SlotInner}, {child.SlotOuter}], lane half-width {lane}");
|
||||
Assert.True(child.SlotInner <= child.Distance - 2 * lane && child.SlotOuter >= child.Distance + 2 * lane,
|
||||
$"the only child's slot [{child.SlotInner}, {child.SlotOuter}] has no room for a lane of {lane} at {child.Distance}");
|
||||
Assert.False(ZoneGenerator.LaneHost(child, lane));
|
||||
}
|
||||
|
||||
// A belt's field kind is chosen at generation and saved with it (Mining Cut 3, Q16 B): every belt the generator writes,
|
||||
// annulus, swarm or lane, carries one before any Zone reads it (finding ensure-unpinned).
|
||||
[Fact]
|
||||
public void EveryBeltIsKindedAtGeneration()
|
||||
{
|
||||
var zones = _samples.Authored;
|
||||
_out.WriteLine($"belts {zones.Belts}, unkinded at generation {zones.UnkindedAtGeneration}");
|
||||
Assert.True(zones.All.Any(z => z.Zone.AsteroidBelts.Values.Any(b => b.Data.RidesRail)), "no swarm in the sample");
|
||||
Assert.True(zones.All.Any(z => BeltShapes.Lanes(z.Zone).Any()), "no lane in the sample");
|
||||
Assert.True(zones.Belts > 20, $"only {zones.Belts} belts generated");
|
||||
Assert.Equal(0, zones.UnkindedAtGeneration);
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ public sealed class ShipSchemaPinTests
|
|||
[InlineData("SCHEMATIC_LINES_SLOT", typeof(ShipAuthoring), nameof(ShipAuthoring.SchematicLines))]
|
||||
[InlineData("HULL_SHAPE_SLOT", typeof(HullData), nameof(HullData.Shape))]
|
||||
[InlineData("HULL_HARDPOINTS_SLOT", typeof(HullData), nameof(HullData.Hardpoints))]
|
||||
[InlineData("HULL_TYPE_SLOT", typeof(HullData), nameof(HullData.HullType))]
|
||||
[InlineData("PRODUCT_MANUFACTURER_SLOT", typeof(FactionProductData), nameof(FactionProductData.Manufacturer))]
|
||||
public void PythonSlotConstantsAreTheKeysOfTheMembersTheyNameInTheirComments(string constant, Type owner, string member)
|
||||
{
|
||||
|
|
@ -136,6 +137,7 @@ public sealed class ShipSchemaPinTests
|
|||
{
|
||||
Assert.Equal(EnumNames<HardpointType>(), Strings("HARDPOINT_TYPE_NAMES"));
|
||||
Assert.Equal(EnumNames<ItemRotation>(), Strings("ROTATION_NAMES"));
|
||||
Assert.Equal(EnumNames<HullType>(), Strings("HULL_TYPE_NAMES"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -81,10 +81,6 @@ public sealed class StationPlacementTests : IDisposable
|
|||
|
||||
private static float Turns(float turns) => turns - (float) Math.Floor(turns);
|
||||
|
||||
// A Trojan swarm's rail is a copy of its host's, not a station's source.
|
||||
private static bool SwarmRail(Zone zone, CultRecordKey orbit) =>
|
||||
zone.Planets.Values.Any(b => b is AsteroidBeltData { RidesRail: true } && b.Orbit.Key.Equals(orbit));
|
||||
|
||||
[Fact]
|
||||
public void AStationSitsAtItsPlanetsL4OrL5()
|
||||
{
|
||||
|
|
@ -100,7 +96,7 @@ public sealed class StationPlacementTests : IDisposable
|
|||
foreach (var station in zone.Entities.OfType<OrbitalEntity>().Where(e => TypeOf(built.Items, e) == HullType.Station))
|
||||
{
|
||||
var orbit = zone.Orbits[station.OrbitData];
|
||||
var sources = zone.Orbits.Where(o => !ridden.Contains(o.Key) && !SwarmRail(zone, o.Key) && SameRing(o.Value, orbit)).ToList();
|
||||
var sources = zone.Orbits.Where(o => !ridden.Contains(o.Key) && !BeltShapes.CopiedRail(zone, o.Key) && SameRing(o.Value, orbit)).ToList();
|
||||
if (sources.Count == 0)
|
||||
{
|
||||
// The tutorial entrance's one exception: a station on its own orbit round a root node, beyond the node's ring
|
||||
|
|
@ -160,7 +156,7 @@ public sealed class StationPlacementTests : IDisposable
|
|||
foreach (var station in Orbitals(built).Where(e => TypeOf(built.Items, e) == HullType.Station))
|
||||
{
|
||||
var orbit = zone.Orbits[station.OrbitData];
|
||||
var sources = zone.Orbits.Where(o => !ridden.Contains(o.Key) && !SwarmRail(zone, o.Key) && SameRing(o.Value, orbit)).ToList();
|
||||
var sources = zone.Orbits.Where(o => !ridden.Contains(o.Key) && !BeltShapes.CopiedRail(zone, o.Key) && SameRing(o.Value, orbit)).ToList();
|
||||
if (sources.Count == 0) continue; // the tutorial entrance's own orbit round a root
|
||||
stations++;
|
||||
Assert.Contains(bodyOrbits, key => key.Equals(sources[0].Key));
|
||||
|
|
@ -177,7 +173,7 @@ public sealed class StationPlacementTests : IDisposable
|
|||
var placed = new HashSet<CultRecordKey>();
|
||||
foreach (var body in zone.Planets.Values)
|
||||
for (var key = body.Orbit.Key; placed.Add(key) && zone.Orbits[key].Data.Parent.IsSet();) key = zone.Orbits[key].Data.Parent.Key;
|
||||
var beltExtent = zone.AsteroidBelts.ToDictionary(b => zone.Planets[b.Key].Orbit.Key, b => b.Value.Extent(zone.Orbits[zone.Planets[b.Key].Orbit.Key].Data.Distance));
|
||||
var beltExtent = zone.AsteroidBelts.ToDictionary(b => zone.Planets[b.Key].Orbit.Key, b => AsteroidBelt.Extent(b.Value.Data, zone.Orbits[zone.Planets[b.Key].Orbit.Key].Data.Distance));
|
||||
var nodes = placed.Select(k =>
|
||||
{
|
||||
var d = zone.Orbits[k].Data;
|
||||
|
|
@ -357,7 +353,7 @@ public sealed class StationPlacementTests : IDisposable
|
|||
foreach (var station in Orbitals(built).Where(e => TypeOf(built.Items, e) == HullType.Station))
|
||||
{
|
||||
var orbit = zone.Orbits[station.OrbitData];
|
||||
var strays = zone.Orbits.Count(o => !ridden.Contains(o.Key) && !SwarmRail(zone, o.Key) && SameRing(o.Value, orbit));
|
||||
var strays = zone.Orbits.Count(o => !ridden.Contains(o.Key) && !BeltShapes.CopiedRail(zone, o.Key) && SameRing(o.Value, orbit));
|
||||
Assert.True(strays == 1, $"seed {built.Seed}: a station's ring holds {strays} orbits no entity rides, not just its source's");
|
||||
stations++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,37 @@ public class TrojanSwarmTests
|
|||
private static float Turn(float2 p) => frac((float) (Math.Atan2(p.y, p.x) / (2 * Math.PI)));
|
||||
private static float Wrap(float t) => t - (float) Math.Round(t);
|
||||
|
||||
// A standing binary leaves a bodyless node with a parent and its pair's mass, heavy enough to pass the host mass filter; a
|
||||
// swarm round it would ride a rail no body is on (finding swarm-on-bodyless-node). StationPlacementTests' binary tuning with a
|
||||
// swarm drawn for every eligible host: every swarm's rail copies a body's orbit.
|
||||
[Fact]
|
||||
public void NoSwarmRidesABinarysBodylessNode()
|
||||
{
|
||||
using var zones = new ChildrenWithinReachTests.Zones(First, Last, z =>
|
||||
{
|
||||
z.SatelliteCreationProbability = 1;
|
||||
z.BinaryCreationProbability = 1;
|
||||
z.ZoneRadius.Minimum *= 3; z.ZoneRadius.Maximum *= 3;
|
||||
z.ZoneMass.Minimum *= .1f; z.ZoneMass.Maximum *= .1f;
|
||||
z.TrojanProbability = 1;
|
||||
});
|
||||
int binaries = 0, swarms = 0, bodyless = 0;
|
||||
foreach (var (seed, zone) in zones.All)
|
||||
{
|
||||
var bodyOrbits = zone.Planets.Values.Select(b => b.Orbit.Key).ToHashSet();
|
||||
binaries += zone.Orbits.Count(o => o.Value.Data.Parent.IsSet() && !bodyOrbits.Contains(o.Key) && zone.Wells.Reach(o.Key) > 0f);
|
||||
var bodies = zone.Planets.Values.Where(b => !(b is AsteroidBeltData)).Select(b => zone.Orbits[b.Orbit.Key].Data).ToList();
|
||||
foreach (var rail in zone.AsteroidBelts.Where(b => b.Value.Data.RidesRail).Select(b => zone.Orbits[zone.Planets[b.Key].Orbit.Key].Data))
|
||||
{
|
||||
swarms++;
|
||||
if (!bodies.Any(o => o.Parent.Key.Equals(rail.Parent.Key) && o.Distance == rail.Distance && o.Phase == rail.Phase)) bodyless++;
|
||||
}
|
||||
}
|
||||
_out.WriteLine($"zones {zones.All.Count}, bodyless nodes {binaries}, swarms {swarms}, on a bodyless node {bodyless}");
|
||||
Assert.True(binaries > 5 && swarms > 10, $"{binaries} bodyless nodes and {swarms} swarms: the seeds do not exercise the rule");
|
||||
Assert.Equal(0, bodyless);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ASwarmKeepsItsShapeOverAnHour()
|
||||
{
|
||||
|
|
@ -97,23 +128,25 @@ public class TrojanSwarmTests
|
|||
Assert.True(onSwarmHost > 0, "no station or turret sits on a swarm host's rail");
|
||||
}
|
||||
|
||||
// The digests were computed at 67517f40, before this cut, over the zones of each seed with the authored settings: a zone
|
||||
// with no swarm is the base zone, and a zone with swarms is the base zone plus them.
|
||||
// The widened digests (ZoneFingerprint with PopulatedRadius) were computed on Yggdrasil over the generator of cut laned-belts
|
||||
// C1 (one belt extent rule) with swarms off, over the zones of each seed; both samples draw no lane, so the base is the zone
|
||||
// with neither shape: a zone with no swarm is the base zone, and a zone with
|
||||
// swarms is the base zone plus them. The per-zone comparison leaves PopulatedRadius out, since a swarm's outer rock may grow it.
|
||||
private static readonly Dictionary<uint, string> BaseDigest = new Dictionary<uint, string>
|
||||
{
|
||||
[1] = "02a2bef42b5d4aeaf1e7004d0ab26620ee570ced95115abf98226ab4e0db23eb",
|
||||
[2] = "de231f392e5724ecdce7e746957633bef2724252147ecbb5830db047b635aead",
|
||||
[3] = "5c33fe9f748d6b0b34a7bec923216c7f9bbdfdf8f326c59b77fde9ec96ca2bcb",
|
||||
[4] = "585284386657e4714ad325cb053a78853c5bcaf7eb1a02cbd4826b0e86ad3593",
|
||||
[5] = "4a1aeecad09c61ff7daa43eda40a9c0109dc4b6833439b8400d8c72d939950c8",
|
||||
[6] = "7fd3c5844144b73faf05cd6a53fe92274e4455f38da4aaca4624ea13d96a12c3",
|
||||
[1] = "1873400d50d11b27913a67daca460f0829629aa21dacabac2cfc97a66537a700",
|
||||
[2] = "5872680ee91c2019b345925f54c2113303cc2817ee9ea28d26ba839e43d1944e",
|
||||
[3] = "e92cc32010f01b7962a2a58b6ea91c9c39ee3d915301164f176d0ebad218837c",
|
||||
[4] = "61db9bdae2ca8704a7946debb4fe63ae3e649112fcda19d293ba2fddcaf45674",
|
||||
[5] = "69ca46ebfae646b3a09faf9d636f3c706e5f6b7146f111a0ea06196332ae58b9",
|
||||
[6] = "307dc4b38ff341670a5b5179ab977b6c7c59ba682d529d80dcaf9c4852c21fe2",
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void ASwarmMovesNothingElseInTheZone()
|
||||
{
|
||||
using var swarmless = new ChildrenWithinReachTests.Zones(First, Last, z => z.TrojanProbability = 0);
|
||||
using var live = new ChildrenWithinReachTests.Zones(First, Last, null);
|
||||
using var swarmless = new ChildrenWithinReachTests.Zones(First, Last, z => { z.TrojanProbability = 0; z.LaneProbability = 0; });
|
||||
using var live = new ChildrenWithinReachTests.Zones(First, Last, z => z.LaneProbability = 0);
|
||||
Assert.Equal(swarmless.All.Count, live.All.Count);
|
||||
int swarms = 0, grew = 0;
|
||||
foreach (var seed in BaseDigest.Keys)
|
||||
|
|
@ -121,11 +154,11 @@ public class TrojanSwarmTests
|
|||
var a = swarmless.All.Where(x => x.Seed == seed).Select(x => x.Zone).ToList();
|
||||
var b = live.All.Where(x => x.Seed == seed).Select(x => x.Zone).ToList();
|
||||
Assert.Empty(a.SelectMany(z => z.AsteroidBelts.Where(x => x.Value.Data.RidesRail)));
|
||||
Assert.Equal(BaseDigest[seed], ZoneFingerprint.Of(a, _ => false, _ => false));
|
||||
string Swarmed(Zone z) => ZoneFingerprint.Of(new[] { z }, SwarmRails(z).Contains, IsSwarm);
|
||||
Assert.Equal(BaseDigest[seed], ZoneFingerprint.Of(a, _ => false, _ => false, true));
|
||||
string Swarmed(Zone z) => ZoneFingerprint.Of(new[] { z }, SwarmRails(z).Contains, IsSwarm, false);
|
||||
for (var n = 0; n < a.Count; n++)
|
||||
{
|
||||
Assert.Equal(ZoneFingerprint.Of(new[] { a[n] }, _ => false, _ => false), Swarmed(b[n]));
|
||||
Assert.Equal(ZoneFingerprint.Of(new[] { a[n] }, _ => false, _ => false, false), Swarmed(b[n]));
|
||||
swarms += SwarmRails(b[n]).Count;
|
||||
Assert.True(b[n].PopulatedRadius >= a[n].PopulatedRadius, $"seed {seed}: a swarm shrank the populated radius");
|
||||
if (b[n].PopulatedRadius > a[n].PopulatedRadius) grew++;
|
||||
|
|
@ -148,11 +181,11 @@ public class TrojanSwarmTests
|
|||
var belt = MessagePackSerializer.Deserialize<AsteroidBeltData>(old, options);
|
||||
Assert.False(belt.RidesRail);
|
||||
Assert.Equal(3f, belt.Asteroids[0].Distance);
|
||||
Assert.Equal(7f, new AsteroidBelt(belt).Extent(7f));
|
||||
Assert.Equal(3f, new AsteroidBelt(belt).Extent(2f));
|
||||
Assert.Equal(7f, AsteroidBelt.Extent(belt, 7f));
|
||||
Assert.Equal(3f, AsteroidBelt.Extent(belt, 2f));
|
||||
var swarm = MessagePackSerializer.Deserialize<AsteroidBeltData>(MessagePackSerializer.Serialize(
|
||||
new AsteroidBeltData { Asteroids = belt.Asteroids, RidesRail = true }, options), options);
|
||||
Assert.True(swarm.RidesRail);
|
||||
Assert.Equal(2f, new AsteroidBelt(swarm).Extent(2f));
|
||||
Assert.Equal(2f, AsteroidBelt.Extent(swarm, 2f));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,29 +9,42 @@ using static CultMath.math;
|
|||
using float2 = CultMath.float2;
|
||||
|
||||
// A digest of what a zone's generation and build decide, so a test can pin it to a value computed at an earlier commit:
|
||||
// every orbit's (Distance, Phase, Period, Reach, Support), every body's (type, Mass, rail Distance, belt rocks), the entity
|
||||
// count and GetHeight at three points round each non-belt body. Cache keys and names are left out; they are minted, not decided.
|
||||
// every orbit's (Distance, Phase, Period, Reach, Support); every body's (type, Mass, rail Distance) and each belt rock's
|
||||
// (Distance, Phase, Size, RotationSpeed, Period); every orbital entity's (type, position, rail Distance and Phase) and any other
|
||||
// entity's type alone (a ship packed at the origin is scattered from the clock-seeded item stream, Zone.cs:276); the pack radius;
|
||||
// GetHeight on a 9x9 grid over the pack at t 0 and 777.7; and, when asked, PopulatedRadius. Cache keys and names are left
|
||||
// out; they are minted, not decided.
|
||||
public static class ZoneFingerprint
|
||||
{
|
||||
public static string Of(IEnumerable<Zone> zones, Func<CultRecordKey, bool> skipOrbit, Func<BodyData, bool> skipBody)
|
||||
public static string Of(IEnumerable<Zone> zones, Func<CultRecordKey, bool> skipOrbit, Func<BodyData, bool> skipBody, bool populatedRadius)
|
||||
{
|
||||
var text = new StringBuilder();
|
||||
foreach (var zone in zones) text.Append(Describe(zone, skipOrbit, skipBody)).Append('\n');
|
||||
foreach (var zone in zones) text.Append(Describe(zone, skipOrbit, skipBody, populatedRadius)).Append('\n');
|
||||
return Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(text.ToString()))).ToLowerInvariant();
|
||||
}
|
||||
|
||||
private static string Describe(Zone z, Func<CultRecordKey, bool> skipOrbit, Func<BodyData, bool> skipBody)
|
||||
private static string Describe(Zone z, Func<CultRecordKey, bool> skipOrbit, Func<BodyData, bool> skipBody, bool populatedRadius)
|
||||
{
|
||||
string F(float v) => v.ToString("R", System.Globalization.CultureInfo.InvariantCulture);
|
||||
string F(double v) => v.ToString("R", System.Globalization.CultureInfo.InvariantCulture);
|
||||
var orbits = z.Orbits.Where(o => !skipOrbit(o.Key))
|
||||
.Select(o => $"{F(o.Value.Data.Distance)},{F(o.Value.Data.Phase)},{F(o.Value.Period)},{F(z.Wells.Reach(o.Key))},{F(z.Wells.Support(o.Key))}")
|
||||
.OrderBy(x => x, StringComparer.Ordinal);
|
||||
var bodies = z.Planets.Values.Where(b => !skipBody(b))
|
||||
.Select(b => $"{b.GetType().Name},{F(b.Mass)},{F(z.Orbits[b.Orbit.Key].Data.Distance)}," +
|
||||
(b is AsteroidBeltData belt ? string.Join("|", belt.Asteroids.Select(r => $"{F(r.Distance)}/{F(r.Phase)}/{F(r.Size)}")) : ""))
|
||||
var bodies = z.Planets.Where(b => !skipBody(b.Value))
|
||||
.Select(b => $"{b.Value.GetType().Name},{F(b.Value.Mass)},{F(z.Orbits[b.Value.Orbit.Key].Data.Distance)}," +
|
||||
(b.Value is AsteroidBeltData belt ? string.Join("|", belt.Asteroids.Select((r, i) =>
|
||||
$"{F(r.Distance)}/{F(r.Phase)}/{F(r.Size)}/{F(r.RotationSpeed)}/{F(z.AsteroidBelts[b.Key].Periods[i])}")) : ""))
|
||||
.OrderBy(x => x, StringComparer.Ordinal);
|
||||
var heights = z.Planets.Values.Where(b => !(b is AsteroidBeltData)).Select(b => z.Orbits[b.Orbit.Key].Position)
|
||||
.SelectMany(p => new[] { float2(0, 0), float2(37, 0), float2(0, -211) }.Select(o => F(z.GetHeight(p + o))));
|
||||
return string.Join(";", orbits) + "#" + string.Join(";", bodies) + "#" + z.Entities.Count() + "#" + string.Join(",", heights);
|
||||
var entities = z.Entities.Select(e => e is OrbitalEntity o
|
||||
? $"{e.GetType().Name},{F(e.Position.x)},{F(e.Position.y)},{F(e.Position.z)},{F(z.Orbits[o.OrbitData].Data.Distance)},{F(z.Orbits[o.OrbitData].Data.Phase)}"
|
||||
: e.GetType().Name)
|
||||
.OrderBy(x => x, StringComparer.Ordinal);
|
||||
var r = z.Pack.Radius;
|
||||
var heights = new List<string>();
|
||||
foreach (var t in new[] { 0.0, 777.7 })
|
||||
for (var i = -4; i <= 4; i++)
|
||||
for (var j = -4; j <= 4; j++)
|
||||
heights.Add(F(z.GetHeight(float2(i * r / 4f, j * r / 4f), t)));
|
||||
return string.Join(";", orbits) + "#" + string.Join(";", bodies) + "#" + string.Join(";", entities) + "#" + F(r) + "#" +
|
||||
string.Join(",", heights) + (populatedRadius ? "#" + F(z.PopulatedRadius) : "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue