From 035303ab10c7891662d6f36f838d31694960da3d Mon Sep 17 00:00:00 2001 From: Lurkars Date: Sat, 15 Apr 2017 01:40:42 +0200 Subject: [PATCH] fixed triple points calculation --- js/game.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/game.js b/js/game.js index 5fcaeda..4555d85 100644 --- a/js/game.js +++ b/js/game.js @@ -258,10 +258,14 @@ Game.prototype.calculatePoints = function(diceIndex) { } else if (pairs == 3) { points += 1500; } else if (triple1) { - points += triple1 * (triple1 == 1 ? 1000 : 100) * (result[triple1 - 1] - 2); + var triple1Points = triple1 * (triple1 == 1 ? 1000 : 100); + for (var i = 0; i < result[triple1 - 1] - 3; i++) { + triple1Points *= 2; + } + points += triple1Points; if (triple2) { - points += triple2 * (triple2 == 1 ? 1000 : 100) * (result[triple2 - 1] - 2); + points += triple2 * (triple2 == 1 ? 1000 : 100); } }