namespace MultiversalDiplomacy.Model;
public static class ModelExtensions
{
///
/// Short representation of a .
///
public static string ToShort(this UnitType unitType)
=> unitType switch
{
UnitType.Army => "A",
UnitType.Fleet => "F",
_ => throw new NotSupportedException($"Unknown unit type {unitType}"),
};
///
/// Short representation of a multiversal location.
///
public static string ToShort(this (Province province, Season season) coord)
{
return $"{coord.season.Timeline}-{coord.province.Abbreviations[0]}@{coord.season.Turn}";
}
public static World ContinueOrFork(this World world, Season season, out Season future)
{
future = world.ContinueOrFork(season);
return world.Update(seasons: world.Seasons.Append(future));
}
}