From aec7c36487d2e102fdcd45654527ebb127b9f324 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Wed, 18 Sep 2024 17:31:08 +0100 Subject: Updates to scoring --- rules.js | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/rules.js b/rules.js index 47ecd29..ef07391 100644 --- a/rules.js +++ b/rules.js @@ -2636,6 +2636,9 @@ function score_country(country) { value_control = 4 } //Log for scoring + + let dem_vp = 0 + let com_vp = 0 //Check for presence let presence = check_presence(country) console.log('presence: ', presence) @@ -2645,17 +2648,25 @@ function score_country(country) { log(`Democrat:`) if (presence.dem_control) { log(`Control: +${value_control} VP`) + dem_vp += value_control } else { log(`Domination: +${value_domination} VP`) + dem_vp += value_domination } log(`Battlegrounds: +${presence.dem_battlegrounds} VP`) + dem_vp += presence.dem_battlegrounds + log(`Total: ${dem_vp} VP`) + log_gap('Communist:') if (presence.com_spaces > 0) { log(`Presence: -${value_presence} VP`) + com_vp -= value_presence if (presence.com_battlegrounds >0) { - log(`Battlegrounds: -${presence.com_battlegrounds} VP`) + log(`Battlegrounds: -${presence.com_battlegrounds} VP`) + com_vp -= presence.com_battlegrounds } + log(`Total: ${com_vp} VP`) } else { log('No presence: 0 VP') } @@ -2665,17 +2676,25 @@ function score_country(country) { log('Communist:') if (presence.com_control) { log(`Control: -${value_control} VP`) + com_vp -= value_control } else { log(`Domination: -${value_domination} VP`) + com_vp -= value_domination } log(`Battlegrounds: -${presence.com_battlegrounds} VP`) + com_vp -= presence.com_battlegrounds + log(`Total: ${com_vp} VP`) + log_gap('Democrat:') if (presence.dem_spaces > 0) { log(`Presence: +${value_presence} VP`) + dem_vp += value_presence if (presence.dem_battlegrounds > 0) { - log(`Battlegrounds: +${presence.dem_battlegrounds} VP`) + log(`Battlegrounds: +${presence.dem_battlegrounds} VP`) + dem_vp += presence.dem_battlegrounds } + log (`Total: ${dem_vp} VP`) } else { log('No presence: 0 VP') } @@ -2690,6 +2709,7 @@ function score_country(country) { log(`Presence: -${value_presence} VP`) if (presence.com_battlegrounds > 0) { log(`Battlegrounds: -${presence.com_battlegrounds} VP`) + com_vp -= presence.com_battlegrounds } } else { log('No presence: 0 VP') @@ -2699,6 +2719,7 @@ function score_country(country) { log(`Presence: +${value_presence} VP`) if (presence.dem_battlegrounds > 0) { log(`Battlegrounds: +${presence.dem_battlegrounds} VP`) + dem_vp += presence.dem_battlegrounds } } else { log('No presence: 0 VP') @@ -2707,11 +2728,11 @@ function score_country(country) { //Calculate change VP - let dem_vp = 0 + /*let dem_vp = 0 if (presence.dem_spaces > 0) {dem_vp += value_presence} if (presence.dem_domination) {dem_vp += value_presence} if (presence.dem_control && country !== "Hungary") { - dem_vp += value + dem_vp += value_control } else if (presence.dem_control && country === "Hungary") {dem_vp += 2} dem_vp += presence.dem_battlegrounds @@ -2721,9 +2742,9 @@ function score_country(country) { if (presence.com_domination) {com_vp += value_presence} if (presence.com_control && country !== "Hungary") {com_vp += value_presence} else if (presence.com_control && country === "Hungary") {com_vp += 2} - com_vp += presence.com_battlegrounds - let change_vp = dem_vp - com_vp - game.vp += change_vp + com_vp += presence.com_battlegrounds */ + let change_vp = dem_vp + com_vp + game.vp += change_vp log_gap(`Final VP: ${change_vp} VP`) } -- cgit v1.2.3