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
72 lines
2.6 KiB
C#
72 lines
2.6 KiB
C#
using Nonemm.Core;
|
|
|
|
namespace Nonemm.Contests.Rules;
|
|
|
|
/// The YOTA contest. The exchange is the operator's age, a contact with a
|
|
/// young operator is worth more, and every age worked on a band is a
|
|
/// multiplier.
|
|
///
|
|
/// N1MM has no class for this one — it is logged there through a `.udc` file,
|
|
/// which is why the contest name is plain `YOTA`.
|
|
public sealed class Yota : Contest
|
|
{
|
|
public string Name => "YOTA";
|
|
|
|
public string DisplayName => "YOTA Contest";
|
|
|
|
public string CabrilloName => "YOTA";
|
|
|
|
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
|
|
[
|
|
new ExchangeField("Snt", ExchangeSlot.SentReport, ExchangeFieldKind.Report, IsRequired: false),
|
|
new ExchangeField("Rcv", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
|
|
new ExchangeField("Age", ExchangeSlot.Exchange1, ExchangeFieldKind.Number) { Width = 3 },
|
|
];
|
|
|
|
public IReadOnlyList<string> MultiplierNamesFor(StationInfo me) => ["Ages"];
|
|
|
|
public DupeScope DupeScope => DupeScope.PerBandAndMode;
|
|
|
|
public bool HasSerialNumbers => false;
|
|
|
|
public IReadOnlyList<ModeCategory> Modes => [ModeCategory.Cw, ModeCategory.Phone];
|
|
|
|
/// The operator's own age, which the contest setup asks for.
|
|
public string SentExchangeFor(StationInfo me) => "";
|
|
|
|
/// A contact with an operator of 25 or under is worth 10 to 13 points by
|
|
/// age, whatever the continent. Everyone else is worth 1 point on your own
|
|
/// continent and 3 from another.
|
|
public int PointsFor(QsoContext qso) => Age(qso) switch
|
|
{
|
|
null or > 25 => qso.IsSameContinent ? 1 : 3,
|
|
<= 12 => 13,
|
|
<= 16 => 12,
|
|
<= 21 => 11,
|
|
_ => 10,
|
|
};
|
|
|
|
/// Each age worked on a band, whatever the mode.
|
|
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso) =>
|
|
Age(qso) is { } age ? [new Multiplier(1, age.ToString(), 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(entry.SentExchange, 3),
|
|
],
|
|
[
|
|
new CabrilloField(qso.Call.Text, 13),
|
|
new CabrilloField(qso.ReceivedReport, 3),
|
|
new CabrilloField(qso.Exchange1, 3),
|
|
]);
|
|
|
|
private static int? Age(QsoContext qso) =>
|
|
int.TryParse(qso.Qso.Exchange1.Trim(), out int age) && age > 0 ? age : null;
|
|
}
|