diff options
Diffstat (limited to 'lib/colonial_twilight')
-rw-r--r-- | lib/colonial_twilight/board.rb | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/lib/colonial_twilight/board.rb b/lib/colonial_twilight/board.rb index 4acf9b3..5fc46b7 100644 --- a/lib/colonial_twilight/board.rb +++ b/lib/colonial_twilight/board.rb @@ -690,66 +690,3 @@ end # class ColonialTwilight::Sector # undef :adjacents= # end - -if $PROGRAM_NAME == __FILE__ - def check(board) - # puts '--- Coastal' - # board.spaces.select{ |s| s.coastal? }.each { |s| puts s.name } - raise 'coastal sectors error' if board.spaces.select(&:coastal?).size != 14 - # puts '--- not Mountain' - # board.spaces.select{ |s| not s.mountain? }.each { |s| puts s.name } - raise 'not moauntain sectors error' if board.spaces.reject(&:mountain?).size != 9 - # puts '--- Border' - # board.spaces.select{ |s| s.border? }.each { |s| puts s.name } - raise 'border sectors error' if board.spaces.select(&:border?).size != 9 - # puts '--- City' - # board.spaces.select{ |s| s.city? }.each { |s| puts s.name } - raise 'city sectors error' if board.spaces.select(&:city?).size != 3 - - [[0, 11], [1, 9], [2, 9], [3, 1]].each do |p, n| - # puts "--- Population #{p}" - # board.spaces.select{ |s| s.pop==p }.each { |s| puts s.name } - raise "population #{p} error" if board.spaces.select { |s| s.pop == p }.size != n - end - raise 'sectors count wrong' if board.sectors.size != 28 - end - - def check_forces what, board, vals - sup, opp, gov, fln = 0, 0, 0, 0 - ft, fp, at, ap, g = 0, 0, 0, 0, 0 - gb, fb = 0, 0 - board.spaces.each do |s| - sup += 1 if s.alignment == :support - opp += 1 if s.alignment == :oppose - gov += 1 if s.control == :GOV - fln += 1 if s.control == :FLN - unless s.country? - ft += s.french_troops - fp += s.french_police - at += s.algerian_troops - ap += s.algerian_police - gb += s.gov_bases - end - g += s.fln_underground - fb += s.fln_bases - end - raise "wrong support #{sup} != #{vals[0]}" if sup != vals[0] - raise "wrong oppose #{opp} != #{vals[1]}" if opp != vals[1] - raise "wrong GOV control #{gov} != #{vals[2]}" if gov != vals[2] - raise "wrong FLN control #{fln} != #{vals[3]}" if fln != vals[3] - raise "wrong french troops #{ft} != #{vals[4]}" if ft != vals[4] - raise "wrong french police #{fp} != #{vals[5]}" if fp != vals[5] - raise "wrong algerian troops #{at} != #{vals[6]}" if at != vals[6] - raise "wrong algerian police #{ap} != #{vals[7]}" if ap != vals[7] - raise "wrong Guerrillas #{g} != #{vals[8]}" if g != vals[8] - raise "wrong GOV bases #{gb} != #{vals[9]}" if gb != vals[9] - raise "wrong FLN bases #{fb} != #{vals[10]}" if fb != vals[10] - end - - b = ColonialTwilight::Board.new - puts 'check' - check b - b.load :short - check_forces 'short', b, [3, 7, 16, 3, 9, 17, 3, 7, 17, 4, 8] - puts 'ok' -end |