Class: AntColony::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ant_colony/cli.rb

Instance Method Summary collapse

Instance Method Details

#solve(file, point) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/ant_colony/cli.rb', line 14

def solve(file, point)
  params = options.map { |k, v| [k.to_sym, v] }.to_h
  graph  = YAML.load_file(file)
  colony = AntColony::Colony.new(graph, **params)
  colony.solve
  $stdout.puts colony.find_path(point.to_i)
end