Files
Nonemm/src/Nonemm.Contests/Rules/FieldDayRegionOne.cs
T
erikbrockoandClaude Opus 5 b5d9f1e21c Name the All Asian multiplier after what it counts
The score window and the stored Contest.Multiplier1Name row both said
"Prefixes" for an Asian entrant, which counts DXCC entities.

Contest.MultiplierNames is now MultiplierNamesFor(StationInfo me), the
same shape as ExchangeFieldsFor. Every other contest returns the same
list it did before; All Asian returns "Countries" from Asia and
"Prefixes" from everywhere else. ContestDefinitions.For takes the
station as well, because that name is written to the log for N1MM.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0157i7PiZyqBkquxS9A6FTdQ
2026-09-10 20:47:51 +00:00

75 lines
2.9 KiB
C#

using Nonemm.Core;
namespace Nonemm.Contests.Rules;
/// The IARU Region 1 Field Day. A portable station is worth 5 points, a station
/// in Region 1 operating from home 2, and one outside Region 1 3. The exchange
/// is a serial number and the countries are multipliers, once per band.
public sealed class FieldDayRegionOne : Contest
{
public string Name => "FDREG1";
public string DisplayName => "IARU Region 1 Field Day";
public string CabrilloName => "FIELDDAY-REGION-1";
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
[
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("Nr", ExchangeSlot.SerialNumber, ExchangeFieldKind.Number),
];
public IReadOnlyList<string> MultiplierNamesFor(StationInfo me) => ["Countries"];
public DupeScope DupeScope => DupeScope.PerBandAndMode;
public bool HasSerialNumbers => true;
public IReadOnlyList<ModeCategory> Modes => [ModeCategory.Cw, ModeCategory.Phone];
public string SentExchangeFor(StationInfo me) => "001";
public int PointsFor(QsoContext qso)
{
if (IsPortable(qso.Qso.Call))
{
return 5;
}
return IsRegionOne(qso.Continent) ? 2 : 3;
}
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso) =>
qso.CountryPrefix.Length == 0
? []
: [new Multiplier(1, qso.CountryPrefix, 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),
]);
/// A field day station signs portable, mobile or /A.
private static bool IsPortable(Callsign call) =>
call.Text.EndsWith("/P", StringComparison.OrdinalIgnoreCase)
|| call.Text.EndsWith("/M", StringComparison.OrdinalIgnoreCase)
|| call.Text.EndsWith("/A", StringComparison.OrdinalIgnoreCase);
/// Region 1 is Europe, Africa and the Middle East. The country file has a
/// continent for the first two; the Middle East is inside Asia, which is
/// split between regions, and the continent alone does not separate them.
private static bool IsRegionOne(string continent) => continent is "EU" or "AF";
}