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
82 lines
2.7 KiB
C#
82 lines
2.7 KiB
C#
using Nonemm.Core;
|
|
|
|
namespace Nonemm.Contests.Rules;
|
|
|
|
/// IARU HF World Championship. The exchange is an ITU zone or, for a society
|
|
/// headquarters station, its abbreviation; both count as multipliers per band.
|
|
///
|
|
/// The received zone or abbreviation goes in the section column, which is where
|
|
/// N1MM keeps it.
|
|
public sealed class IaruHf : Contest
|
|
{
|
|
public string Name => "IARU";
|
|
|
|
public string DisplayName => "IARU HF World Championship";
|
|
|
|
public string CabrilloName => "IARU-HF";
|
|
|
|
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
|
|
[
|
|
new ExchangeField("Snt", ExchangeSlot.SentReport, ExchangeFieldKind.Report, IsRequired: false),
|
|
new ExchangeField("Rcv", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
|
|
new ExchangeField("ITU-Zone", ExchangeSlot.Section, ExchangeFieldKind.Text) { Width = 6 },
|
|
];
|
|
|
|
public IReadOnlyList<string> MultiplierNames => ["Zones", "HQ"];
|
|
|
|
public bool UsesItuZones => true;
|
|
|
|
public DupeScope DupeScope => DupeScope.PerBandAndMode;
|
|
|
|
public bool HasSerialNumbers => false;
|
|
|
|
public IReadOnlyList<ModeCategory> Modes => [ModeCategory.Cw, ModeCategory.Phone];
|
|
|
|
public string SentExchangeFor(StationInfo me) => me.ItuZone.ToString();
|
|
|
|
public int PointsFor(QsoContext qso)
|
|
{
|
|
string exchange = Exchange(qso);
|
|
if (!IsZone(exchange))
|
|
{
|
|
return 1;
|
|
}
|
|
if (int.TryParse(exchange, out int zone) && zone == qso.Me.ItuZone)
|
|
{
|
|
return 1;
|
|
}
|
|
return qso.IsSameContinent ? 3 : 5;
|
|
}
|
|
|
|
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso)
|
|
{
|
|
string exchange = Exchange(qso);
|
|
if (exchange.Length == 0)
|
|
{
|
|
return [];
|
|
}
|
|
string band = qso.Band?.Name ?? "";
|
|
return [new Multiplier(IsZone(exchange) ? 1 : 2, exchange, band)];
|
|
}
|
|
|
|
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(me.ItuZone.ToString(), 6),
|
|
],
|
|
[
|
|
new CabrilloField(qso.Call.Text, 13),
|
|
new CabrilloField(qso.ReceivedReport, 3),
|
|
new CabrilloField(qso.Section, 6),
|
|
]);
|
|
|
|
private static string Exchange(QsoContext qso) => qso.Qso.Section.Trim().ToUpperInvariant();
|
|
|
|
private static bool IsZone(string exchange) =>
|
|
exchange.Length > 0 && exchange.All(char.IsAsciiDigit);
|
|
}
|