Skip to content

Extending the calc.js module to cater for a 3x15_21 #47

Description

@lule75

Hello Philhag there is an experimental scoring by BWF for a 3x15_21 similar to your #45 . kindly update your calc.js file to cater for this scheme.
I made the following changes offline to make it work.

...if (counting === '3x15_21') {
return (
((candidate == 15) && (other < 14)) ||
((candidate > 15) && (candidate <= 21) && (other == candidate - 2)) ||
(candidate == 21) && (other == 20)
);
}

@game_winner

... } else if (counting === '3x15_21') {
if ((left_score < 15) && (right_score < 15)) {
return 'inprogress';
}
if ((left_score < 21) && (right_score >= left_score - 1) && (right_score <= left_score + 1)) {
return 'inprogress';
}
}
@winning_game_count
Most 3-game series use 2 wins:
...
case '3x15_21':
return 2;

@max_game_count
Most 3-game series max at 3:

... case '3x15_21':
return 3;

recalc_after_score (interval detection)
Add the interval logic (midpoint) for "3x15_21". Assuming midpoint at 8 points (similar to other 3x15 variants):

} else if (counting === '3x15_21') {
is_interval = (
(s.game.score[team_id] === 8) && (s.game.score[1 - team_id] < 8)
);
}

@NetScore
Add "3x15_21" to _finish_score rules. Max score is 21; win-by-2 if opponent ≥ 14:

....} else if (counting === '3x15_21') {
if (score[1 - winner] >= 20) {
score[winner] = 21;
} else if (score[1 - winner] >= 14) {
score[winner] = score[1 - winner] + 2;
} else {
score[winner] = 15;
}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions