common startup
This commit is contained in:
parent
675a73ddd3
commit
6a34b0f309
@ -16,8 +16,8 @@ auto Compute(Machine machine, ValueType x, ValueType y) {
|
||||
|
||||
} // namespace
|
||||
|
||||
auto main() -> int {
|
||||
auto machine = Machine{ParseStream(std::cin)};
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto machine = Startup(argc, argv);
|
||||
|
||||
std::cout << "Part 1: " << Compute(machine, 12, 2) << std::endl;
|
||||
|
||||
|
@ -16,8 +16,8 @@ auto Compute(Machine machine, ValueType d) -> ValueType {
|
||||
|
||||
} // namespace
|
||||
|
||||
auto main() -> int {
|
||||
auto machine = Machine{ParseStream(std::cin)};
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto machine = Startup(argc, argv);
|
||||
std::cout << "Part 1: " << Compute(machine, 1) << std::endl;
|
||||
std::cout << "Part 2: " << Compute(std::move(machine), 5) << std::endl;
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ auto optimize(Machine machine, std::vector<ValueType> params, F f) {
|
||||
|
||||
} // namespace
|
||||
|
||||
auto main() -> int {
|
||||
auto machine = Machine{ParseStream(std::cin)};
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto machine = Startup(argc, argv);
|
||||
std::cout << "Part 1: " << optimize(machine, {0, 1, 2, 3, 4}, compute1) << std::endl;
|
||||
std::cout << "Part 2: " << optimize(std::move(machine), {5, 6, 7, 8, 9}, compute2) << std::endl;
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ auto Compute(Machine machine, ValueType d) -> ValueType {
|
||||
|
||||
} // namespace
|
||||
|
||||
auto main() -> int {
|
||||
auto machine = Machine{ParseStream(std::cin)};
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto machine = Startup(argc, argv);
|
||||
std::cout << "Part 1: " << Compute(machine, 1) << std::endl;
|
||||
std::cout << "Part 2: " << Compute(std::move(machine), 2) << std::endl;
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ auto Compute(Machine machine, ValueType start)
|
||||
|
||||
} // namespace
|
||||
|
||||
auto main() -> int {
|
||||
auto machine = Machine{ParseStream(std::cin)};
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto machine = Startup(argc, argv);
|
||||
std::cout << "Part 1: " << Compute(machine, 0).size() << "\nPart 2\n";
|
||||
Draw(std::cout, Compute(std::move(machine), 1));
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ auto Compute2(Machine machine) {
|
||||
|
||||
} // namespace
|
||||
|
||||
auto main() -> int {
|
||||
auto machine = Machine{ParseStream(std::cin)};
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto machine = Startup(argc, argv);
|
||||
std::cout << "Part 1: " << Compute1(machine) << std::endl;
|
||||
std::cout << "Part 2: " << Compute2(std::move(machine)) << std::endl;
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ auto Compute(std::map<Coord, ValueType> world) -> std::pair<int, int> {
|
||||
|
||||
} // namespace
|
||||
|
||||
auto main() -> int {
|
||||
auto [p1,p2] = Compute(Explore(Machine{ParseStream(std::cin)}));
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto [p1,p2] = Compute(Explore(Startup(argc, argv)));
|
||||
std::cout << "Part 1: " << p1 << std::endl;
|
||||
std::cout << "Part 2: " << p2 << std::endl;
|
||||
}
|
||||
|
@ -54,9 +54,8 @@ auto Interact(Ethernet & ethernet, Machine & m, std::optional<Payload> p) -> voi
|
||||
|
||||
} // namespace
|
||||
|
||||
auto main() -> int {
|
||||
std::ifstream fin { "/Users/emertens/Source/advent/inputs/2019/23.txt" };
|
||||
auto machines = BuildNetwork(Machine{ParseStream(fin)});
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto machines = BuildNetwork(Startup(argc, argv));
|
||||
auto ethernet = Ethernet{};
|
||||
|
||||
std::optional<ValueType> part1;
|
||||
|
@ -1,2 +1,2 @@
|
||||
add_library(intcode src/Coord.cpp src/Parser.cpp src/Interpreter.cpp src/Machine.cpp)
|
||||
add_library(intcode src/Coord.cpp src/Parser.cpp src/Interpreter.cpp src/Machine.cpp src/Startup.cpp)
|
||||
target_include_directories(intcode PUBLIC include)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <intcode/Interpreter.hpp>
|
||||
#include <intcode/Machine.hpp>
|
||||
#include <intcode/Parser.hpp>
|
||||
#include <intcode/Startup.hpp>
|
||||
#include <Overload.hpp>
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user