Skip to content

Commit

Permalink
SS - inject errors into both Check and Sect values
Browse files Browse the repository at this point in the history
For ARRL SS, both the Check and Section values will have errors
injected at a 10% rate each. Earlier code has only injected the
error into the Section value, not the Check value.

Fixes Issue #367
  • Loading branch information
w7sst committed Sep 28, 2024
1 parent d7ba7a2 commit eacfdc5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions ArrlSS.pas
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,25 @@ function TSweepstakes.GetCheckSection(const ACallsign: string;
AThreshold: Single): String;
var
ssrec: TSweepstakesCallRec;
check: integer;
section: string;
begin
if FindCallRec(ssrec, ACallsign) then
begin
if (Random < AThreshold) then
section := GetAlternateSection(ssrec.Section)
else
section := ssrec.Section;
result := format('%.02d %s', [ssrec.Check, section]);
check := ssrec.Check;
if Random < AThreshold then // 10%
begin
if Random(2) = 0 then
check := (check+1) mod 100
else
check := ((check-1) + 100) mod 100;
end;

section := ssrec.Section;
if Random < AThreshold then // 10%
section := GetAlternateSection(section);

result := format('%.02d %s', [check, section]);
end
else
result:= '';
Expand Down

0 comments on commit eacfdc5

Please sign in to comment.