summaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-01-10 22:35:32 +0100
committeremkael <emkael@tlen.pl>2020-01-10 22:35:32 +0100
commitfc6a2893e4e9d87d4752adba7675628a6152823a (patch)
tree5a70d420a55b003a6fe9d53e5e770334d71fb80f /http
parent27d32d8b5b5a6bab278bebaafdb2c07d38778701 (diff)
2020.01.01 version (new KMP)
Diffstat (limited to 'http')
-rw-r--r--http/api-inc.php14
-rw-r--r--http/api.php3
2 files changed, 16 insertions, 1 deletions
diff --git a/http/api-inc.php b/http/api-inc.php
index 041c8ff..64612d9 100644
--- a/http/api-inc.php
+++ b/http/api-inc.php
@@ -203,4 +203,18 @@ class ApiPkl {
class ApiPklV1 extends ApiPkl {}
+class ApiPklV2 extends ApiPklV1 {
+
+ function calculate_kmp_points() {
+ // the line below works only because you can't play > 39 boards in KMP
+ // please kill me if it ever changes
+ $this->parameters['tournament_weight'] = 4;
+ $this->parameters['min_points'] = 0;
+ $intermediate = $this->calculate_points();
+ $this->parameters['min_points'] = $intermediate['points'][1] + 10;
+ return $this->calculate_points();
+ }
+
+}
+
?>
diff --git a/http/api.php b/http/api.php
index ea633e3..0458831 100644
--- a/http/api.php
+++ b/http/api.php
@@ -34,7 +34,8 @@ function run($parameters) {
try {
$versionClasses = array(
- '1' => 'ApiPklV1', // RegKlas 2018.11.01
+ '1' => 'ApiPklV1', // RegKlas 2018.11.01
+ '2' => 'ApiPklV2', // RegKMP 2020.01.01
'_default' => 'ApiPklV1'
);
$version = isset($parameters['version']) ? $parameters['version'] : '_default';