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
+78
View File
@@ -0,0 +1,78 @@
using Nonemm.Core;
using Nonemm.Core.Country;
namespace Nonemm.Contests.Rules;
/// The Mexico RTTY contest. A Mexican station sends its state, everyone else a
/// serial number. A contact with Mexico is worth 4 points, one inside your own
/// country 2, and anything else 3. The multipliers are the countries and the
/// Mexican states, each once per band.
public sealed class MexicoRtty : Contest
{
public string Name => "XERTTY";
public string DisplayName => "Mexico RTTY Contest";
public string CabrilloName => "XE-RTTY";
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
[
new ExchangeField("RST", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
new ExchangeField("State", ExchangeSlot.Section, ExchangeFieldKind.Text) { Width = 3 },
new ExchangeField("Nr", ExchangeSlot.Exchange1, ExchangeFieldKind.Number),
];
public bool SkipsField(ExchangeField field, CountryLookup? their) => field.Slot switch
{
ExchangeSlot.Section => their is not null && !IsMexican(their.Entity.PrimaryPrefix),
ExchangeSlot.Exchange1 => their is not null && IsMexican(their.Entity.PrimaryPrefix),
_ => false,
};
public IReadOnlyList<string> MultiplierNames => ["Countries", "States"];
public DupeScope DupeScope => DupeScope.PerBand;
public bool HasSerialNumbers => true;
public IReadOnlyList<ModeCategory> Modes => [ModeCategory.Digital];
public string SentExchangeFor(StationInfo me) => IsMexican(me.CountryPrefix) ? me.State : "001";
public int PointsFor(QsoContext qso) =>
IsMexican(qso.CountryPrefix) ? 4 : qso.IsSameCountry ? 2 : 3;
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso)
{
string band = qso.Band?.Name ?? "";
List<Multiplier> found = [];
if (qso.CountryPrefix.Length > 0)
{
found.Add(new Multiplier(1, qso.CountryPrefix, band));
}
string state = qso.Qso.Section.Trim().ToUpperInvariant();
if (IsMexican(qso.CountryPrefix) && state.Length > 0)
{
found.Add(new Multiplier(2, state, band));
}
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(IsMexican(me.CountryPrefix) ? me.State : $"{qso.SentNumber:000}", 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 IsMexican(string countryPrefix) => countryPrefix == "XE";
}