Files
Nonemm/src/Nonemm.Contests/Rules/RussianDxRtty.cs
T
erikbrockoandClaude Opus 5 bae40bb04e Show the boxes N1MM shows for each contest
The entry window had a fixed set of boxes with a Name and Comment box beside
the exchange. N1MM lays out one row of boxes per contest and nothing else, so
this does the same: general logging keeps Name and Comment, and a contest gets
the boxes it exchanges.

Two new members on `Contest` carry the cases where the boxes and the log
columns are not the same list:

- `FromExchange1` spreads what was typed in one box across the log columns.
  Where the other station sends a serial or a district code depending on where
  it is, N1MM gives it one box and sorts the value into the number, section or
  zone column from there, so the score and the Cabrillo file read it from the
  same column N1MM does.
- `LogFieldsFor` gives the log window its own column list. Sweepstakes takes
  the whole exchange in one box and logs it in four columns; `SweepstakesExchange`
  parses `72 A 74 SCV` in any order, reading from the last word back as N1MM
  does.

The sent serial is now marked as not required and space steps over it along
with the two report boxes, because nobody types the number going out.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
2026-09-09 20:12:37 +00:00

88 lines
3.3 KiB
C#

using Nonemm.Core;
using Nonemm.Core.Country;
namespace Nonemm.Contests.Rules;
/// The Russian DX RTTY contest. A Russian station sends its oblast, everyone
/// else their CQ zone. A contact on your own continent is 5 points and one
/// from another 10, and the countries and the oblasts are multipliers, each
/// once per band.
public sealed class RussianDxRtty : Contest
{
public string Name => "RUSDXRTTY";
public string DisplayName => "Russian DX RTTY";
public string CabrilloName => "RADIO-WW-RTTY";
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) => IsRussian(me.CountryPrefix)
?
[
new ExchangeField("Snt", ExchangeSlot.SentReport, ExchangeFieldKind.Report, IsRequired: false),
new ExchangeField("Rcv", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
new ExchangeField("Exch", ExchangeSlot.Exchange1, ExchangeFieldKind.Text) { Width = 3 },
]
:
[
new ExchangeField("Snt", ExchangeSlot.SentReport, ExchangeFieldKind.Report, IsRequired: false),
new ExchangeField("SentNr", ExchangeSlot.SentNumber, ExchangeFieldKind.Number, IsRequired: false),
new ExchangeField("Rcv", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
new ExchangeField("Exch", ExchangeSlot.Exchange1, ExchangeFieldKind.Text) { Width = 3 },
];
/// A Russian station sends an oblast, which goes in the section column
/// where the multiplier is read from; everyone else sends a CQ zone.
public Qso FromExchange1(Qso qso, string typed) => qso with
{
Section = typed.Trim().ToUpperInvariant(),
};
public IReadOnlyList<string> MultiplierNames => ["Countries", "Oblasts"];
public DupeScope DupeScope => DupeScope.PerBand;
public bool HasSerialNumbers => false;
public IReadOnlyList<ModeCategory> Modes => [ModeCategory.Digital];
public string SentExchangeFor(StationInfo me) =>
IsRussian(me.CountryPrefix) ? me.County : me.CqZone.ToString();
public int PointsFor(QsoContext qso) => qso.IsSameContinent ? 5 : 10;
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 oblast = qso.Qso.Section.Trim().ToUpperInvariant();
if (IsRussian(qso.CountryPrefix) && oblast.Length > 0)
{
found.Add(new Multiplier(2, oblast, 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(SentExchangeFor(me), 6),
],
[
new CabrilloField(qso.Call.Text, 13),
new CabrilloField(qso.ReceivedReport, 3),
new CabrilloField(qso.Section, 6),
]);
private static bool IsRussian(string countryPrefix) =>
countryPrefix is "UA" or "UA2" or "UA9";
}