Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve QSO exchanges for partially correct callsigns #317

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Contest.pas
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ procedure TContest.SendMsg(const AStn: TStation; const AMsg: TStationMessage);
msgDeMyCall2: SendText(AStn, 'DE <my> <my>');
msgDeMyCallNr1: SendText(AStn, 'DE <my> <#>');
msgDeMyCallNr2: SendText(AStn, 'DE <my> <my> <#>');
msgMyCall2: SendText(AStn, '<my> <my>');
msgMyCallNr1: SendText(AStn, '<my> <#>');
msgMyCallNr2: SendText(AStn, '<my> <my> <#>');
msgNrQm: SendText(AStn, 'NR?');
msgLongCQ: SendText(AStn, 'CQ CQ TEST <my> <my> TEST'); // QrmStation only
Expand Down
35 changes: 25 additions & 10 deletions DxOper.pas
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ interface
TDxOperator = class
private
R1: Single; // holds a Random number; used in IsMyCall
R2: Single; // holds a Random number; used in MsgReceived, GetReply
procedure DecPatience;
procedure MorePatience(AValue: integer = 0);
public
Expand Down Expand Up @@ -120,6 +121,7 @@ implementation
constructor TDxOperator.Create(const ACall: string; AState: TOperatorState);
begin
R1 := Random; // a random value assigned at creation provides consistency
R2 := Random; // assigned at creation for consistent responses
Call := ACall;
Skills := 1 + Random(3); //1..3
Patience := 0;
Expand Down Expand Up @@ -437,7 +439,7 @@ procedure TDxOperator.MsgReceived(AMsg: TStationMessages);
if State = osNeedQso then State := osNeedPrevEnd
else if State in [osNeedNr, osNeedCall, osNeedCallNr] then State := osFailed
else if State = osNeedEnd then State := osDone;
end;
end;

if msgB4 in AMsg then
case State of
Expand Down Expand Up @@ -506,17 +508,30 @@ function TDxOperator.GetReply: TStationMessage;
then Result := msgNrQm
else Result := msgAgn;


// osNeedCall - I have their Exch (NR), but need user to correct my call.
osNeedCall:
if (RunMode = rmHst) or (Random > 0.5) then Result := msgDeMyCallNr1
else if Random > 0.25 then Result := msgDeMyCallNr2
else Result := msgMyCallNr2;

if (RunMode = rmHst) then
Result := msgDeMyCallNr1
else
case Trunc(R2*6) of
0: Result := msgDeMyCallNr1; // DE <my> <exch>
1: Result := msgDeMyCallNr2; // DE <my> <my> <exch>
2,3: Result := msgMyCallNr2; // <my> <my> <exch>
4,5: Result := msgMyCallNr1; // <my> <exch>
end;

// osNeedCallNr - They have sent an almost-correct callsign.
osNeedCallNr:
if (RunMode = rmHst) or (Random > 0.5)
then Result := msgDeMyCall1
else Result := msgDeMyCall2;

if (RunMode = rmHst) then
Result := msgDeMyCall1
else
case Trunc(R2*6) of
0: Result := msgDeMyCall1; // DE <my>
1: Result := msgDeMyCall2; // DE <my> <my>
2: Result := msgMyCall2; // <my> <my>
3: Result := msgMyCallNr2; // <my> <my> <exch>
4,5: Result := msgMyCallNr1; // <my> <exch>
end;
else //osNeedEnd:
if Patience < (FULL_PATIENCE-1) then Result := msgNR
else if (RunMode = rmHst) or (Random < 0.9) then Result := msgR_NR
Expand Down
11 changes: 6 additions & 5 deletions DxStn.pas
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,13 @@ procedure TDxStation.SendMsg(AMsg: TStationMessage);
begin
inherited SendMsg(AMsg);

if BDebugExchSettings and (Mainform.Edit2.Text = '') and
(AMsg in [msgNR, msgR_NR, msgR_NR2,
msgDeMyCallNr1, msgDeMyCallNr2, msgMyCallNr2]) then
if BDebugExchSettings and (AMsg in [msgNR, msgR_NR, msgR_NR2,
msgDeMyCallNr1, msgDeMyCallNr2, msgMyCallNr1, msgMyCallNr2]) then
begin
Mainform.Edit2.Text := Exch1;
if (SimContest <> scNaQp) or (Exch2 <> 'DX') then
if (Mainform.Edit2.Text = '') then
Mainform.Edit2.Text := Exch1;
if (Mainform.Edit3.Text = '') and
((SimContest <> scNaQp) or (Exch2 <> 'DX')) then
MainForm.Edit3.Text := Exch2;
end;
end;
Expand Down
2 changes: 1 addition & 1 deletion Log.pas
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ TMultList= class(TStringList)
RawPoints: integer; // accumalated raw QSO points total
VerifiedPoints: integer; // accumulated verified QSO points total
CallSent: boolean; // msgHisCall has been sent; cleared upon edit.
NrSent: boolean; // msgNR has been sent. Seems to imply exchange sent.
NrSent: boolean; // msgNR has been sent; cleared after qso is completed.
ShowCorrections: boolean; // show exchange correction column.
Histo: THisto;
LogColWidths : Array[0..6] of integer; // retain original Log column widths
Expand Down
4 changes: 2 additions & 2 deletions Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1649,9 +1649,9 @@ procedure TMainForm.Readme1Click(Sender: TObject);


{
called whenever callsign field (Edit1) changes. Any callsign edit will
Called whenever callsign field (Edit1) changes. Any callsign edit will
invalidate the callsign already sent by clearing the CallSent value.
If the Callsign is empty, also crear the NrSent value.
If the Callsign is empty, also clear the NrSent value.
}
procedure TMainForm.Edit1Change(Sender: TObject);
begin
Expand Down
4 changes: 2 additions & 2 deletions Station.pas
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ interface
type
TStationMessage = (msgNone, msgCQ, msgNR, msgTU, msgMyCall, msgHisCall,
msgB4, msgQm, msgNil, msgGarbage, msgR_NR, msgR_NR2, msgDeMyCall1, msgDeMyCall2,
msgDeMyCallNr1, msgDeMyCallNr2, msgNrQm, msgLongCQ, msgMyCallNr2,
msgQrl, msgQrl2, msqQsy, msgAgn);
msgDeMyCallNr1, msgDeMyCallNr2, msgMyCallNr1, msgMyCallNr2, msgMyCall2,
msgNrQm, msgLongCQ, msgQrl, msgQrl2, msqQsy, msgAgn);

TStationMessages = set of TStationMessage;

Expand Down