lib/engine/game/g_1862/game.rb
# Brute force it. Theoretical max combos is 729, but realistic max is order of magnitude lower
Brute force it. Theoretical max combos is 729, but realistic max is order of magnitude lower
Brute force it . Theoretical max combos is 729 but realistic max is order of magnitude lower
def global_optimize(routes)
          route_stops = routes.map { |r| revenue_stop_options(r) }
          possibilities = if routes.one?
                            route_stops[0].product
                          else
                            route_stops[0].product(*route_stops[1..-1])
                          end
          max_rev = -1
          max_stops = nil
          possibilities.each do |p|
            rev = stop_revenues(p.flatten.uniq, routes[0]) 
            if rev > max_rev
              max_rev = rev
              max_stops = p
            end
          end
          max_stops
        end
def global_optimize ( routes ) route_stops = routes . map { | r | revenue_stop_options ( r ) } possibilities = if routes . one? route_stops [ 0 ] . product else route_stops [ 0 ] . product ( * route_stops [ 1 .. - 1 ] ) end max_rev = - 1 max_stops = nil possibilities . each do | p | rev = stop_revenues ( p . flatten . uniq , routes [ 0 ] ) if rev > max_rev max_rev = rev max_stops = p end end max_stops end
Brute force it.
Brute force it .
# any route will do here
routes
<not_specific>