Log the time the BARTG exchange went out
The BARTG RTTY contest sends the time with the serial number, and both stations log the time the other one sent. The entry window now has the report, serial and time boxes N1MM's has, and the time this station sent is stamped into the MiscText column as the exchange message goes out, or at log time when nothing sent it. The Cabrillo line writes that time and falls back to the time of the contact when the column is empty, which is what N1MM writes, in N1MM's columns. The total score was points times every multiplier. N1MM's class works out points times the countries and areas together, times the continents. Per-contact points and multiplier flags do not change, so the station's 2022 log still scores contact for contact as N1MM did. N1MM has a class each for the March HF RTTY contest and the September sprint. This program has one contest holding the March rules under the sprint's name, and docs/unfinished.md now says so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoGtneMQaz4M9w7Kk49AVD
This commit is contained in:
@@ -79,6 +79,11 @@ public sealed partial class EntryWindow
|
||||
Status("no keyer — Config ▸ Keyer");
|
||||
return;
|
||||
}
|
||||
if (index == Esm.Exchange)
|
||||
{
|
||||
// the BARTG contest sends the time, and logs the one it sent
|
||||
Logging.StampSentTime();
|
||||
}
|
||||
string text = prefix + plan.Text;
|
||||
// the box has to point at this radio before the key does
|
||||
await session.PointTransmitAtAsync(radioNumber);
|
||||
|
||||
@@ -55,6 +55,11 @@ public interface Contest
|
||||
/// contests the same question.
|
||||
bool UsesItuZones => false;
|
||||
|
||||
/// True for a contest that sends the time of the exchange as part of it.
|
||||
/// The time this station sent goes in the `MiscText` column, stamped as
|
||||
/// the message goes out. Only the BARTG RTTY contest asks for it.
|
||||
bool StampsSentTime => false;
|
||||
|
||||
/// True for a contest whose log carries QTC traffic as rows of its own.
|
||||
/// The log window then shows the series they belong to.
|
||||
bool HasQtcTraffic => false;
|
||||
|
||||
@@ -2,12 +2,19 @@ using Nonemm.Core;
|
||||
|
||||
namespace Nonemm.Contests.Rules;
|
||||
|
||||
/// The BARTG RTTY Sprint. Every contact is one point; the multipliers are the
|
||||
/// The BARTG RTTY contest. Every contact is one point. The multipliers are the
|
||||
/// countries and the US and Canadian call areas once per band, and the
|
||||
/// continents once in the contest.
|
||||
/// continents once in the contest; the score is the points times the countries
|
||||
/// and areas together, times the continents.
|
||||
///
|
||||
/// The exchange is a serial number. N1MM also writes the time of the contact
|
||||
/// into the exchange column, which the Cabrillo line carries.
|
||||
/// The exchange is a report, a serial number and the time the exchange was
|
||||
/// sent. The time this station sends is stamped into the `MiscText` column as
|
||||
/// the message goes out, which is the column N1MM keeps it in.
|
||||
///
|
||||
/// The rules are N1MM's `CBARTGSpring`, the March HF contest the station has
|
||||
/// logs of. N1MM's September sprint is a class of its own with a shorter
|
||||
/// exchange, and both of N1MM's names for these two contests open a log here
|
||||
/// with the rules below.
|
||||
public sealed class BartgSprint : Contest
|
||||
{
|
||||
public string Name => "BARTGRTTYS";
|
||||
@@ -18,9 +25,15 @@ public sealed class BartgSprint : Contest
|
||||
|
||||
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
|
||||
[
|
||||
new ExchangeField("RST", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
|
||||
new ExchangeField("Nr", ExchangeSlot.SerialNumber, ExchangeFieldKind.Number),
|
||||
new ExchangeField("Time", ExchangeSlot.Exchange1, ExchangeFieldKind.Text) { Width = 4 },
|
||||
];
|
||||
|
||||
/// The time this station sent goes in the `MiscText` column, as it does in
|
||||
/// N1MM.
|
||||
public bool StampsSentTime => true;
|
||||
|
||||
public IReadOnlyList<string> MultiplierNames => ["Countries", "Areas", "Continents"];
|
||||
|
||||
public DupeScope DupeScope => DupeScope.PerBand;
|
||||
@@ -54,18 +67,34 @@ public sealed class BartgSprint : Contest
|
||||
}
|
||||
|
||||
public int TotalScore(ScoreTally tally, ContestEntry entry) =>
|
||||
tally.Points * tally.TotalMultipliers;
|
||||
tally.Points
|
||||
* (tally.MultiplierCount(1) + tally.MultiplierCount(2))
|
||||
* Math.Max(1, tally.MultiplierCount(3));
|
||||
|
||||
public CabrilloExchange CabrilloExchange(Qso qso, StationInfo me, ContestEntry entry) =>
|
||||
new(
|
||||
[
|
||||
new CabrilloField(me.Callsign, 13),
|
||||
new CabrilloField($"{qso.SentNumber:000}", 4),
|
||||
new CabrilloField(qso.TimestampUtc.ToString("HHmm"), 4),
|
||||
new CabrilloField(me.Callsign, 10),
|
||||
new CabrilloField(qso.SentReport, 3),
|
||||
new CabrilloField($"{qso.SentNumber:0000}", 4),
|
||||
new CabrilloField(SentTime(qso), 4),
|
||||
],
|
||||
[
|
||||
new CabrilloField(qso.Call.Text, 13),
|
||||
new CabrilloField($"{qso.ReceivedNumber:000}", 4),
|
||||
new CabrilloField(qso.Exchange1, 4),
|
||||
new CabrilloField(qso.Call.Text, 10),
|
||||
new CabrilloField(qso.ReceivedReport, 3),
|
||||
new CabrilloField($"{qso.ReceivedNumber:0000}", 4),
|
||||
new CabrilloField(FourDigits(qso.Exchange1), 4),
|
||||
]);
|
||||
|
||||
/// The time this station sent, and the time of the contact for a contact
|
||||
/// logged before that was filled in. N1MM writes the same two.
|
||||
private static string SentTime(Qso qso) =>
|
||||
qso.MiscText.Trim().Length > 0
|
||||
? FourDigits(qso.MiscText)
|
||||
: qso.TimestampUtc.ToString("HHmm");
|
||||
|
||||
/// `905` is written `0905`, which is what N1MM writes for a time typed
|
||||
/// without its leading zero.
|
||||
private static string FourDigits(string time) =>
|
||||
int.TryParse(time.Trim(), out int minutes) ? $"{minutes:0000}" : time.Trim();
|
||||
}
|
||||
|
||||
@@ -44,6 +44,10 @@ public sealed class OperatingPosition
|
||||
|
||||
public string Comment { get; set; } = "";
|
||||
|
||||
/// The time this station sent, `HHmm`, for a contest that exchanges it.
|
||||
/// Empty until the exchange has gone out.
|
||||
public string SentTime { get; private set; } = "";
|
||||
|
||||
public Contest Contest => Session.Contest;
|
||||
|
||||
public ContestInstance Instance => Session.Instance;
|
||||
@@ -199,13 +203,28 @@ public sealed class OperatingPosition
|
||||
{
|
||||
throw new InvalidOperationException($"the exchange for {Entry.Call} is not complete");
|
||||
}
|
||||
StampSentTime();
|
||||
Qso stored = Session.Add(Noted(BuildQso(Entry.Call.Trim())));
|
||||
Entry.Clear();
|
||||
OtherName = "";
|
||||
Comment = "";
|
||||
SentTime = "";
|
||||
return stored;
|
||||
}
|
||||
|
||||
/// Notes the time the exchange went out, which the BARTG RTTY contest
|
||||
/// sends and logs. The first message of a contact sets it, so the time in
|
||||
/// the log is the time the other station copied, not the time the contact
|
||||
/// was logged. Does nothing for the contests that do not send a time.
|
||||
public void StampSentTime()
|
||||
{
|
||||
if (Contest.StampsSentTime && SentTime.Length == 0 && Entry.Call.Trim().Length > 2)
|
||||
{
|
||||
SentTime = DateTime.UtcNow.ToString("HHmm");
|
||||
Session.NotifyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// Puts the report the operator would send anyway into the report boxes
|
||||
/// that are empty: 599 on CW and digital modes, 59 on phone. N1MM does the
|
||||
/// same when the callsign box is left, which is why neither program stops
|
||||
@@ -386,6 +405,7 @@ public sealed class OperatingPosition
|
||||
Entry.Clear();
|
||||
OtherName = "";
|
||||
Comment = "";
|
||||
SentTime = "";
|
||||
Session.NotifyChanged();
|
||||
}
|
||||
|
||||
@@ -396,6 +416,7 @@ public sealed class OperatingPosition
|
||||
{
|
||||
Name = qso.Name.Length > 0 ? qso.Name : OtherName.Trim(),
|
||||
Comment = qso.Comment.Length > 0 ? qso.Comment : Comment.Trim(),
|
||||
MiscText = qso.MiscText.Length > 0 ? qso.MiscText : SentTime,
|
||||
};
|
||||
|
||||
/// The report an operator sends without thinking about it: 599 on CW and
|
||||
|
||||
Reference in New Issue
Block a user