summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2023-10-30 14:18:21 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2023-10-30 14:18:21 +0100
commite42ecf6768f1b1a39c2357334b4ae2cd49f29b35 (patch)
tree5be6f725a406a1176f2ddb0f402614b790ead7af
parenta9e12740c8ce7f0a27a8f43612f00004a0f75fd7 (diff)
downloadcolonial-twilight-e42ecf6768f1b1a39c2357334b4ae2cd49f29b35.zip
colonial-twilight-e42ecf6768f1b1a39c2357334b4ae2cd49f29b35.tar.gz
FLNRules : fix #may_extort_in?
-rw-r--r--lib/colonial_twilight/fln_rules.rb3
-rw-r--r--spec/fln_rules_spec.rb4
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/colonial_twilight/fln_rules.rb b/lib/colonial_twilight/fln_rules.rb
index a472844..9e3bddd 100644
--- a/lib/colonial_twilight/fln_rules.rb
+++ b/lib/colonial_twilight/fln_rules.rb
@@ -50,8 +50,7 @@ module ColonialTwilight
# Extort 4.3.1
def may_extort_in?(space)
- !space.pop.zero? && space.fln_underground.positive? && space.fln_control? &&
- (space.country? ? space.independent? : true)
+ space.fln_underground.positive? && (space.country? ? space.independent? : !space.pop.zero? && space.fln_control?)
end
def extort_spaces(board)
diff --git a/spec/fln_rules_spec.rb b/spec/fln_rules_spec.rb
index 9a4ebdc..6a39759 100644
--- a/spec/fln_rules_spec.rb
+++ b/spec/fln_rules_spec.rb
@@ -116,8 +116,8 @@ describe ColonialTwilight::FLNRules do
it 'collects spaces where operation can be conducted' do
@board.load :short
- # 2 sectors
- expect(rules.extort_spaces(@board).size).to eq(2)
+ # 2 sectors + 2 countries
+ expect(rules.extort_spaces(@board).size).to eq(4)
end
end