From 2fef4dc157be757a030ce71e69edff1a33e531cf Mon Sep 17 00:00:00 2001 From: Leander Date: Mon, 1 May 2017 20:09:22 +0200 Subject: [PATCH] new score multiplication --- answer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/answer.php b/answer.php index 3d5a404..0f1560f 100644 --- a/answer.php +++ b/answer.php @@ -93,7 +93,9 @@ if($uid == '') { $answered_questions = $db->query('SELECT "answered_questions" FROM "Games" WHERE "ID" = $1', array($uid))['data'][0]['answered_questions']; $new_points = round($new_points / $answered_questions); - $new_user_high = $old_user_high == 0 ? $new_points : round($old_user_high * 0.95 + $new_points * 0.05); + $score_multiplyer = 0.005 * $answered_questions; + $new_user_high = $old_user_high == 0 ? $new_points : round($old_user_high * (1 - $score_multiplyer) + + $new_points * $score_multiplyer); $db->query('UPDATE "Users" SET "highscore" = $1, "current_token" = NULL WHERE "ID" = $2', array($new_user_high, $uid)); $db->query('DELETE FROM "Games" WHERE "ID" = $1', array($uid)); }