lib/engine/game/g_1862/game.rb
# Every non-permanent freight train needs to share it's start and/or end
# with another non-permanent freight trains and one permanent freight
# train if it exists
Every non-permanent freight train needs to share it's start and/or end
with another non-permanent freight trains and one permanent freight
train if it exists
Every non - permanent freight train needs to share it ' s start and / or end with another non - permanent freight trains and one permanent freight train if it exists
def check_freight_intersections(routes)
          freight_sets = freight_sets(routes)
          if freight_sets.count { |set| set.any? { |r| nonpermanent_freight?(r.train) } } > 1
            raise GameError, 'All non-permanent freight trains need to connect end-to-end'
          end
          if (nonperm_set = freight_sets.find { |set| set.any? { |r| nonpermanent_freight?(r.train) } }) &&
              nonperm_set.all? { |r| nonpermanent_freight?(r.train) } &&
              freight_sets.size > 1
            raise GameError, 'Non-permanent freight trains must connect to permanent trains'
          end
        end
def check_freight_intersections ( routes ) freight_sets = freight_sets ( routes ) if freight_sets . count { | set | set . any? { | r | nonpermanent_freight? ( r . train ) } } > 1 raise GameError , 'All non-permanent freight trains need to connect end-to-end' end if ( nonperm_set = freight_sets . find { | set | set . any? { | r | nonpermanent_freight? ( r . train ) } } ) && nonperm_set . all? { | r | nonpermanent_freight? ( r . train ) } && freight_sets . size > 1 raise GameError , 'Non-permanent freight trains must connect to permanent trains' end end
Every non-permanent freight train needs to share it's start and/or end
with another non-permanent freight trains and one permanent freight
train if it exists
Every non - permanent freight train needs to share it ' s start and / or end with another non - permanent freight trains and one permanent freight train if it exists
# only one set can have non-perms # if a set has non-perms, it either must have perms too, or be the only set
routes
<not_specific>