diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-10-24 01:01:10 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-10-24 01:01:10 +0200 |
commit | 982dda64511b2f827c2d7fac36e29005834b4fae (patch) | |
tree | 64b0b4e69f3aa6d798389d8110145dd85402e68d /rules.js | |
parent | 0542afc3648576c30a56fdf30fd24a532b51228a (diff) | |
download | maria-982dda64511b2f827c2d7fac36e29005834b4fae.tar.gz |
end game scoring
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -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 |