Add IOTA, the EU DX Contest, CQ 160 and Mexico RTTY

Four more of the contests in the station's log. IOTA, CQ 160 and Mexico RTTY
score every contact in it exactly as N1MM did.

IOTA pays 15 points for a station that sends an island reference and 2 for one
that does not, and counts each reference once per band and mode. CQ 160 is one
band, so its states and countries count once each. Mexico RTTY and CQ 160 both
take a state from one side of the contest and a serial or a zone from the
other, in the columns N1MM keeps them in.

The EU DX Contest is written from N1MM's class, including its list of what
counts as Europe: the European Union, its outermost regions and its overseas
territories, and nothing else. The station's own logs were made with the .udc
file, which scores and counts two things differently; docs/unfinished.md says
which.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RoGtneMQaz4M9w7Kk49AVD
This commit is contained in:
2026-08-31 09:33:29 +00:00
co-authored by Claude Opus 5
parent 3932f83147
commit 7d9bc05e9a
12 changed files with 471 additions and 7 deletions
+91
View File
@@ -0,0 +1,91 @@
using Nonemm.Contests.Multipliers;
using Nonemm.Core;
using Nonemm.Core.Country;
namespace Nonemm.Contests.Rules;
/// The CQ 160 metre contest, CW and phone. One band, so nothing is counted per
/// band: the multipliers are the states, provinces and countries worked, and
/// the points are 2 inside your own country, 5 on your own continent and 10
/// from another.
///
/// A US or Canadian station sends a state or province, which N1MM keeps in the
/// section column; everyone else sends a CQ zone, which it keeps in the
/// exchange column.
public sealed class CqOneSixty : Contest
{
private readonly ModeCategory mode;
public CqOneSixty(ModeCategory mode) => this.mode = mode;
public string Name => mode == ModeCategory.Cw ? "CQ160CW" : "CQ160SSB";
public string DisplayName => $"CQ World-Wide 160 Metre {ModeLabel()}";
public string CabrilloName => mode == ModeCategory.Cw ? "CQ-160-CW" : "CQ-160-SSB";
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
[
new ExchangeField("RST", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
new ExchangeField("S/P", ExchangeSlot.Section, ExchangeFieldKind.UsStateOrCanadianProvince),
new ExchangeField("Zone", ExchangeSlot.Exchange1, ExchangeFieldKind.CqZone),
];
public bool SkipsField(ExchangeField field, CountryLookup? their) => field.Slot switch
{
ExchangeSlot.Section => their is not null && !IsUsOrCanadian(their.Entity.PrimaryPrefix),
ExchangeSlot.Exchange1 => their is not null && IsUsOrCanadian(their.Entity.PrimaryPrefix),
_ => false,
};
public IReadOnlyList<string> MultiplierNames => ["States", "Countries"];
public DupeScope DupeScope => DupeScope.Once;
public bool HasSerialNumbers => false;
public IReadOnlyList<ModeCategory> Modes => [mode];
public string SentExchangeFor(StationInfo me) =>
IsUsOrCanadian(me.CountryPrefix)
? me.State.Length > 0 ? me.State : me.Province
: me.CqZone.ToString();
public int PointsFor(QsoContext qso) =>
qso.IsSameCountry ? 2 : qso.IsSameContinent ? 5 : 10;
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso)
{
List<Multiplier> found = [];
string area = StatesAndProvinces.ArrlDxArea(qso.Qso.Section);
if (StatesAndProvinces.ArrlDxMultipliers.Contains(area))
{
found.Add(new Multiplier(1, area, ""));
}
if (qso.CountryPrefix.Length > 0)
{
found.Add(new Multiplier(2, qso.CountryPrefix, ""));
}
return found;
}
public int TotalScore(ScoreTally tally, ContestEntry entry) =>
tally.Points * tally.TotalMultipliers;
public CabrilloExchange CabrilloExchange(Qso qso, StationInfo me, ContestEntry entry) =>
new(
[
new CabrilloField(me.Callsign, 13),
new CabrilloField(qso.SentReport, 3),
new CabrilloField(SentExchangeFor(me), 6),
],
[
new CabrilloField(qso.Call.Text, 13),
new CabrilloField(qso.ReceivedReport, 3),
new CabrilloField(qso.Section.Length > 0 ? qso.Section : qso.Exchange1, 6),
]);
private static bool IsUsOrCanadian(string countryPrefix) => countryPrefix is "K" or "VE";
private string ModeLabel() => mode == ModeCategory.Cw ? "CW" : "SSB";
}