From 982dda64511b2f827c2d7fac36e29005834b4fae Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 24 Oct 2024 01:01:10 +0200 Subject: end game scoring --- rules.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/rules.js b/rules.js index 8bf4434..138d5bb 100644 --- a/rules.js +++ b/rules.js @@ -2540,7 +2540,27 @@ function end_re_enter_train() { function goto_winter_turn() { - // TODO: winter scoring + // record winter scores + for (let pow of all_major_powers) + game.score[pow].push(count_vp_markers_in_pool(pow)) + + if (game.turn === 16) { + log("Winter Scores") + let best_score = 1000 + let best_power = -1 + for (let pow of all_major_powers) { + log(">" + power_name[pow] + " " + game.score[pow].join(", ")) + let total = 0 + for (let n of game.score[pow]) + total += n + if (total <= best_score) { + best_score = total + best_power = pow + } + } + goto_game_over(player_from_power(best_power), power_name[best] + " won!") + return + } game.stage = 0 goto_winter_stage() @@ -4857,6 +4877,7 @@ exports.setup = function (seed, _scenario, _options) { turn: 0, stage: 0, + score: [ [], [], [], [] ], // winter scores vp: [ 0, 0, 0, 0, 0, 0 ], // battle victory points, set-aside VP saxony: 2, // political track russia: 6, // political track -- cgit v1.2.3