diff options
-rw-r--r-- | lib/colonial_twilight/fln_rules.rb | 13 | ||||
-rw-r--r-- | spec/fln_rules_spec.rb | 12 |
2 files changed, 23 insertions, 2 deletions
diff --git a/lib/colonial_twilight/fln_rules.rb b/lib/colonial_twilight/fln_rules.rb index fa07805..dac834b 100644 --- a/lib/colonial_twilight/fln_rules.rb +++ b/lib/colonial_twilight/fln_rules.rb @@ -1,10 +1,11 @@ #! /usr/bin/env ruby # frozen_string_literal: true +# rubocop:disable Style/Documentation +# module ColonialTwilight - # general rules governing operations and activities module FLNRules - # Rally 3.3.1 + # Rally 3.3.1 + France Track def may_rally_in?(space) (space.sector? || (space.city? && !space.support?) || (space.country? && space.independent?)) end @@ -13,6 +14,14 @@ module ColonialTwilight board.search { |s| may_rally_in? s } end + def may_agitate_in?(space) + (!space.country? && (space.fln_control? || space.fln_bases.positive?)) + end + + def agitate_spaces(spaces) + spaces.select { |s| may_agitate_in? s } + end + # March 3.3.2 # Attack 3.3.3 diff --git a/spec/fln_rules_spec.rb b/spec/fln_rules_spec.rb index 8c3ec04..486d3ec 100644 --- a/spec/fln_rules_spec.rb +++ b/spec/fln_rules_spec.rb @@ -22,6 +22,18 @@ describe ColonialTwilight::FLNRules do it 'collects spaces where operation can be conducted' do expect(rules.rally_spaces(board).size).to eq(27) end end + describe 'Agitate' do + board = ColonialTwilight::Board.new + it 'collects spaces where operation can be conducted' do expect(rules.agitate_spaces(board.spaces).size).to eq(0) end + end + + describe 'Agitate' do + board = ColonialTwilight::Board.new + board.load :short + # 6 with bases + 1 in fln control + it 'collects spaces where operation can be conducted' do expect(rules.agitate_spaces(board.spaces).size).to eq(5) end + end + describe 'Attack' do board = ColonialTwilight::Board.new # 25 sectors + 3 cities |