Skip to content

Commit

Permalink
Change SS Precedence distribution to 50/20/20/10 (#365)
Browse files Browse the repository at this point in the history
Stations are created with the following distributions for Precedence
values:
- 50% A
- 20% B
- 20% U
- 10% for remaining Q, M, S to be evenly distributed

Also changed Section error injection to 10%.

Issue #364.
  • Loading branch information
w7sst committed Sep 27, 2024
2 parents 19c3667 + 335a541 commit 2eec56c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
21 changes: 17 additions & 4 deletions ArrlSS.pas
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ TSweepstakes = class(TContest)
procedure SaveEnteredExchToQso(var Qso: TQso; const AExch1, AExch2: string); override;
function GetStationInfo(const ACallsign: string) : string; override;
function ExtractMultiplier(Qso: PQso) : string; override;
function GetCheckSection(const ACallsign: string; AThreshold: extended = 0): String;
function GetCheckSection(const ACallsign: string; AThreshold: Single = 0): String;
function IsNum(Num: String): Boolean;
end;

Expand Down Expand Up @@ -412,10 +412,23 @@ function TSweepstakes.getCall(id:integer): string; // returns station callsi
}
procedure TSweepstakes.GetExchange(id : integer; out station : TDxStation);
const
PrecedenceTbl: array[0..5] of string = ('Q', 'A', 'B', 'U', 'M', 'S');
PrecedenceTbl: array[0..5] of string = ('A', 'B', 'U', 'Q', 'M', 'S');
begin
station.NR := GetRandomSerialNR; // serial number
station.Prec := PrecedenceTbl[Random(6)];

// Mark, KD0EE, recommends 50% calls are A, 20% B, 20% U, 10% for the rest.
// Jim, K6OK, reported 37% calls are A, 19% B, 36% U, 10% for the rest.
// Using the average ... 43% A, 19% B, 28% U, 10% for Q, M and S.
var R: Single := Random;
if R < 0.43 then
station.Prec := PrecedenceTbl[0]
else if R < 0.62 then
station.Prec := PrecedenceTbl[1]
else if R < 0.90 then
station.Prec := PrecedenceTbl[2]
else
station.Prec := PrecedenceTbl[3+Random(3)];

station.Chk := SweepstakesCallList.Items[id].Check;
station.Sect := SweepstakesCallList.Items[id].Section;
station.UserText := SweepstakesCallList.Items[id].UserText;
Expand Down Expand Up @@ -464,7 +477,7 @@ function TSweepstakes.ExtractMultiplier(Qso: PQso) : string;
so the user has to correct the string being copied.
}
function TSweepstakes.GetCheckSection(const ACallsign: string;
AThreshold: extended): String;
AThreshold: Single): String;
var
ssrec: TSweepstakesCallRec;
section: string;
Expand Down
3 changes: 2 additions & 1 deletion Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,8 @@ procedure TMainForm.Advance;
(ActiveControl = Edit3) and (Edit3.Text = '') and
(Random < (ShowCheckSection/100)) then
begin
var S: string := (Tst as TSweepstakes).GetCheckSection(Edit1.Text, 0.25);
// inject a Section error 10% of the time
var S: string := (Tst as TSweepstakes).GetCheckSection(Edit1.Text, 0.10);
if not S.IsEmpty then
S := S + ' ';
Edit3.Text := S;
Expand Down
1 change: 0 additions & 1 deletion Util/Lexer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ constructor TLexer.Create(const ARules: array of TTokenRuleDef;
Rule.regex := Reg;
Rule.tokenType := Def.T;
Rules.Add(Rule);
Reg := nil;
end;
end;

Expand Down

0 comments on commit 2eec56c

Please sign in to comment.