-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxkcd287.rb
20 lines (17 loc) · 830 Bytes
/
xkcd287.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require_relative './lib/problem_data'
require_relative './lib/file_parser'
require_relative './lib/solver'
require_relative './lib/iterative_solver'
require_relative './lib/recursive_solver'
data_from_files = FileParser.process_files(ARGV)
problem_sets = []
data_from_files.each { |data| problem_sets << ProblemData.new(data[0], data[1]) }
if problem_sets.empty?
puts('No files processed. Either place a .txt file in this directory or specify a file via command-line argument.')
else
problem_sets.each do |problem_set|
# IterativeSolver.new.solve(problem_set, true) # <- brute force iterative solution
# RecursiveSolver.new.solve(problem_set, true, false) # <- recursive solution without memoization
RecursiveSolver.new.solve(problem_set, true) # <- recursive solution WITH memoization and truncation
end
end