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
78 lines
2.8 KiB
C#
78 lines
2.8 KiB
C#
using Nonemm.Core;
|
|
|
|
namespace Nonemm.Contests.Rules;
|
|
|
|
/// The Oceania DX contest, CW and phone. Only contacts with Oceania count for
|
|
/// a station outside it, and they are worth more the lower the band: 20 points
|
|
/// on 160 metres, 10 on 80, 5 on 40 and 1 on the higher bands. Each prefix
|
|
/// worked counts once per band.
|
|
public sealed class OceaniaDx : Contest
|
|
{
|
|
private readonly ModeCategory mode;
|
|
|
|
public OceaniaDx(ModeCategory mode) => this.mode = mode;
|
|
|
|
public string Name => mode == ModeCategory.Cw ? "OceaniaCW" : "OceaniaSSB";
|
|
|
|
public string DisplayName => $"Oceania DX {ModeLabel()}";
|
|
|
|
public string CabrilloName => mode == ModeCategory.Cw ? "Oceania-DX-CW" : "Oceania-DX-SSB";
|
|
|
|
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
|
|
[
|
|
new ExchangeField("Snt", ExchangeSlot.SentReport, ExchangeFieldKind.Report, IsRequired: false),
|
|
new ExchangeField("SntNR", ExchangeSlot.SentNumber, ExchangeFieldKind.Number, IsRequired: false),
|
|
new ExchangeField("Rcv", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
|
|
new ExchangeField("RcvNR", ExchangeSlot.SerialNumber, ExchangeFieldKind.Number),
|
|
];
|
|
|
|
public IReadOnlyList<string> MultiplierNames => ["Prefixes"];
|
|
|
|
public DupeScope DupeScope => DupeScope.PerBand;
|
|
|
|
public bool HasSerialNumbers => true;
|
|
|
|
public IReadOnlyList<ModeCategory> Modes => [mode];
|
|
|
|
public string SentExchangeFor(StationInfo me) => "001";
|
|
|
|
public int PointsFor(QsoContext qso) =>
|
|
IsWorkable(qso) ? PointsOn(qso.Band) : 0;
|
|
|
|
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso) =>
|
|
IsWorkable(qso) && qso.Qso.Call.WpxPrefix() is { } prefix
|
|
? [new Multiplier(1, prefix, qso.Band?.Name ?? "")]
|
|
: [];
|
|
|
|
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($"{qso.SentNumber:000}", 4),
|
|
],
|
|
[
|
|
new CabrilloField(qso.Call.Text, 13),
|
|
new CabrilloField(qso.ReceivedReport, 3),
|
|
new CabrilloField($"{qso.ReceivedNumber:000}", 4),
|
|
]);
|
|
|
|
/// One side of every contact has to be in Oceania.
|
|
private static bool IsWorkable(QsoContext qso) =>
|
|
qso.Continent == "OC" || qso.Me.Continent == "OC";
|
|
|
|
private static int PointsOn(Band? band) => band?.Name switch
|
|
{
|
|
"160M" => 20,
|
|
"80M" => 10,
|
|
"40M" => 5,
|
|
null => 0,
|
|
_ => 1,
|
|
};
|
|
|
|
private string ModeLabel() => mode == ModeCategory.Cw ? "CW" : "SSB";
|
|
}
|