diff --git a/build/CMakeFiles/HLlib.dir/src/HiddenLines.cpp.o b/build/CMakeFiles/HLlib.dir/src/HiddenLines.cpp.o index 6e6a2df..c0f1662 100644 Binary files a/build/CMakeFiles/HLlib.dir/src/HiddenLines.cpp.o and b/build/CMakeFiles/HLlib.dir/src/HiddenLines.cpp.o differ diff --git a/build/CMakeFiles/main.dir/src/main.cpp.o b/build/CMakeFiles/main.dir/src/main.cpp.o index b05c52c..40da628 100644 Binary files a/build/CMakeFiles/main.dir/src/main.cpp.o and b/build/CMakeFiles/main.dir/src/main.cpp.o differ diff --git a/build/libHLlib.a b/build/libHLlib.a index f0257c0..a292790 100644 Binary files a/build/libHLlib.a and b/build/libHLlib.a differ diff --git a/build/main b/build/main index f797fad..c367524 100755 Binary files a/build/main and b/build/main differ diff --git a/src/HiddenLines.cpp b/src/HiddenLines.cpp index 40d7ab5..233fdbb 100644 --- a/src/HiddenLines.cpp +++ b/src/HiddenLines.cpp @@ -26,7 +26,7 @@ void HL::print_sol() } //Divide and Conquer Strategy using recursive call to divide ls and merge using merge() -std::set HL::gen_sol(std::set& ls){ +std::set HL::gen_sol(const std::set& ls){ HL inst = *this; if (ls.size() > 2){ @@ -129,6 +129,14 @@ std::set HL::construct_HWprob(){ lines.insert(newline); } + + std::cout << "Sorted Lines by slope:" << std::endl; + for(Line line : lines) + { + std::cout << "Line " << line.get_id() << " has slope " << line.get_slope() + << " and a y-intercept of " << line.get_ycept() << std::endl; + } + return lines; } diff --git a/src/HiddenLines.h b/src/HiddenLines.h index bf72af8..9de6458 100644 --- a/src/HiddenLines.h +++ b/src/HiddenLines.h @@ -10,7 +10,7 @@ class HL HL(); void print_sol(); - std::set gen_sol(std::set& ls); + std::set gen_sol(const std::set& ls); std::set construct_HWprob(); std::set get_lines() const; diff --git a/src/main.cpp b/src/main.cpp index 4bc7928..b17a837 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,17 +12,9 @@ int main(int argc, char *argv[]) std::cout << "Constructing Problem..." << std::endl; HL inst = HL(); - std::set lines = inst.get_lines(); - - std::cout << "Sorted Lines by slope:" << std::endl; - for(Line line : lines) - { - std::cout << "Line " << line.get_id() << " has slope " << line.get_slope() - << " and a y-intercept of " << line.get_ycept() << std::endl; - } - std::cout << "Generating Solution." << std::endl; - inst.gen_sol(lines); + inst.gen_sol(inst.get_lines()); + std::cout << "Solution is: " << std::endl; inst.print_sol(); }