Add the rest of the major contests, .udc files and the registry

ARRL DX, IARU HF, Sweepstakes, RTTY Roundup, NAQP and general logging join
CQ WW and CQ WPX. The Cabrillo QSO line is now built column by column by the
contest, because Sweepstakes puts the callsign after the serial number where
everyone else puts it first.

User-defined contests read the subset of N1MM's .udc settings that covers the
exchange, the dupe rule, points and up to three multipliers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik
2026-08-27 10:35:28 +00:00
co-authored by Claude Opus 5
parent 0f84bc8972
commit ef631f1dc4
26 changed files with 1162 additions and 13 deletions
+92
View File
@@ -0,0 +1,92 @@
using Nonemm.Contests.Multipliers;
using Nonemm.Core;
namespace Nonemm.Contests.Rules;
/// ARRL International DX, CW and SSB. W and VE stations work DX and nobody
/// else, so the exchange and the multiplier both depend on which side the
/// operator is on.
public sealed class ArrlDx : Contest
{
private readonly ModeCategory mode;
public ArrlDx(ModeCategory mode) => this.mode = mode;
public string Name => "ARRLDX";
public string DisplayName => $"ARRL International DX {ModeLabel()}";
public string CabrilloName => mode == ModeCategory.Cw ? "ARRL-DX-CW" : "ARRL-DX-SSB";
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
[
new ExchangeField("RST", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
IsNorthAmericanHome(me)
? new ExchangeField("Pwr", ExchangeSlot.Exchange1, ExchangeFieldKind.Power)
: new ExchangeField("S/P", ExchangeSlot.Exchange1, ExchangeFieldKind.UsStateOrCanadianProvince),
];
public IReadOnlyList<string> MultiplierNames => ["Mults"];
public DupeScope DupeScope => DupeScope.PerBand;
public bool HasSerialNumbers => false;
public IReadOnlyList<ModeCategory> Modes => [mode];
public string SentExchangeFor(StationInfo me) =>
IsNorthAmericanHome(me)
? $"{DefaultReport()} {StateOrProvince(me)}"
: $"{DefaultReport()} {me.Power}";
/// Only contacts across the W/VE line count, so a DX station working DX or
/// a W station working W scores nothing.
public int PointsFor(QsoContext qso) =>
IsNorthAmericanHome(qso.Me) == IsNorthAmerican(qso.CountryPrefix) ? 0 : 3;
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso)
{
if (PointsFor(qso) == 0)
{
return [];
}
string band = qso.Band?.Name ?? "";
if (IsNorthAmericanHome(qso.Me))
{
return qso.CountryPrefix.Length == 0 ? [] : [new Multiplier(1, qso.CountryPrefix, band)];
}
string received = qso.Qso.Exchange1.Trim().ToUpperInvariant();
return StatesAndProvinces.ArrlDxMultipliers.Contains(received)
? [new Multiplier(1, received, band)]
: [];
}
public int TotalScore(ScoreTally tally) => tally.Points * tally.TotalMultipliers;
public CabrilloExchange CabrilloExchange(Qso qso, StationInfo me) =>
new(
[
new CabrilloField(me.Callsign, 13),
new CabrilloField(qso.SentReport, 3),
new CabrilloField(IsNorthAmericanHome(me) ? StateOrProvince(me) : me.Power, 6),
],
[
new CabrilloField(qso.Call.Text, 13),
new CabrilloField(qso.ReceivedReport, 3),
new CabrilloField(qso.Exchange1, 6),
]);
private static bool IsNorthAmericanHome(StationInfo me) => IsNorthAmerican(me.CountryPrefix);
/// The contest's W/VE side is the 48 states, DC and Canada; KH6 and KL7
/// count as DX for it.
private static bool IsNorthAmerican(string countryPrefix) =>
countryPrefix is "K" or "VE";
private static string StateOrProvince(StationInfo me) =>
me.State.Length > 0 ? me.State : me.Province;
private string ModeLabel() => mode == ModeCategory.Cw ? "CW" : "SSB";
private string DefaultReport() => mode == ModeCategory.Cw ? "599" : "59";
}