From 82cd62d2c3abe322c4256095ff5d4f1510af28d9 Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Wed, 11 Sep 2024 12:00:11 -0400 Subject: [PATCH 1/4] [18SJ] Corrects edge case nationalization calculation --- lib/engine/game/g_18_sj/game.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/engine/game/g_18_sj/game.rb b/lib/engine/game/g_18_sj/game.rb index f476b4acdf..1a2e00f716 100644 --- a/lib/engine/game/g_18_sj/game.rb +++ b/lib/engine/game/g_18_sj/game.rb @@ -789,7 +789,9 @@ def perform_nationalization end # Merge the corporation with highest share price, and use the first operated as tie break - merged = candidates.max_by { |c| [c.share_price.price, -@round.entities.find_index(c)] } + merged = candidates.max_by do |c| + [c.share_price.price, -c.share_price.coordinates.last, -c.share_price.coordinates.first] + end nationalize_major(merged) end From 09363d3277c4e63eacde365fecd77d9cfad7e01c Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Wed, 11 Sep 2024 13:26:50 -0400 Subject: [PATCH 2/4] minor update --- lib/engine/game/g_18_sj/game.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/engine/game/g_18_sj/game.rb b/lib/engine/game/g_18_sj/game.rb index 1a2e00f716..777d5faf7e 100644 --- a/lib/engine/game/g_18_sj/game.rb +++ b/lib/engine/game/g_18_sj/game.rb @@ -788,7 +788,7 @@ def perform_nationalization return end - # Merge the corporation with highest share price, and use the first operated as tie break + # Merge the corporation with highest share price, and use the first to operate as tie break merged = candidates.max_by do |c| [c.share_price.price, -c.share_price.coordinates.last, -c.share_price.coordinates.first] end From 7332626abda3bdd2de3ca85289ad670ede4887a8 Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Tue, 8 Oct 2024 14:09:41 -0400 Subject: [PATCH 3/4] update to calculation --- lib/engine/game/g_18_sj/game.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/engine/game/g_18_sj/game.rb b/lib/engine/game/g_18_sj/game.rb index 777d5faf7e..f3269c7b48 100644 --- a/lib/engine/game/g_18_sj/game.rb +++ b/lib/engine/game/g_18_sj/game.rb @@ -788,9 +788,9 @@ def perform_nationalization return end - # Merge the corporation with highest share price, and use the first to operate as tie break + # Merge the corporation with highest share price, and use highest token on the pile as tie break merged = candidates.max_by do |c| - [c.share_price.price, -c.share_price.coordinates.last, -c.share_price.coordinates.first] + [c.share_price.price, c.share_price.coordinates.last, c.share_price.corporations.find_index(c)] end nationalize_major(merged) From 44cdbc0c143a7f01b3c751b20a4654b8e652e856 Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Fri, 11 Oct 2024 10:34:20 -0400 Subject: [PATCH 4/4] updated fix --- lib/engine/game/g_18_sj/game.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/engine/game/g_18_sj/game.rb b/lib/engine/game/g_18_sj/game.rb index f3269c7b48..b4969627a9 100644 --- a/lib/engine/game/g_18_sj/game.rb +++ b/lib/engine/game/g_18_sj/game.rb @@ -788,12 +788,8 @@ def perform_nationalization return end - # Merge the corporation with highest share price, and use highest token on the pile as tie break - merged = candidates.max_by do |c| - [c.share_price.price, c.share_price.coordinates.last, c.share_price.corporations.find_index(c)] - end - - nationalize_major(merged) + # nationalizes the highest-valued trainless corp (which has already operated) after a rusting event + nationalize_major(candidates.min) end # If there are 2 station markers on the same city the