summaryrefslogtreecommitdiffstats
path: root/lib/colonial_twilight/fln_bot_rules.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2023-11-09 15:33:11 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2023-11-09 15:33:11 +0100
commit073dca3a5d42204952eeeb0fcbefa753466efc2e (patch)
tree6981d41b7b95d3e41e297b7174bb3dc59e442685 /lib/colonial_twilight/fln_bot_rules.rb
parent7c0cd9e0cb6251b78793f92a41f7377988d3e5df (diff)
downloadcolonial-twilight-073dca3a5d42204952eeeb0fcbefa753466efc2e.zip
colonial-twilight-073dca3a5d42204952eeeb0fcbefa753466efc2e.tar.gz
FLNBotRules : support Subvert
Diffstat (limited to 'lib/colonial_twilight/fln_bot_rules.rb')
-rw-r--r--lib/colonial_twilight/fln_bot_rules.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/colonial_twilight/fln_bot_rules.rb b/lib/colonial_twilight/fln_bot_rules.rb
index 7093740..8173d10 100644
--- a/lib/colonial_twilight/fln_bot_rules.rb
+++ b/lib/colonial_twilight/fln_bot_rules.rb
@@ -168,6 +168,27 @@ module ColonialTwilight
_filter(f, &:country?)
end
+ # Subvert
+
+ def may_subvert_1_in?(space, num)
+ # to remove last cubes
+ r = may_subvert_in?(space) && (space.french_cubes.zero? && space.algerian_cubes <= num)
+ dbg " may_subvert_1_in : #{space.name}", r
+ r
+ end
+
+ def subvert_1_priority(spaces)
+ # Police -> Troop
+ _max(spaces, :algerian_police)
+ end
+
+ def may_subvert_2_in?(space)
+ # to replace 1 Algerian Police
+ r = may_subvert_in?(space) && space.algerian_police.positive?
+ dbg " may_subvert_2_in : #{space.name}", r
+ r
+ end
+
# 8.1.2 - Procedure Guidelines
def _filter(spaces, &block)