git-subtree-dir: 2019 git-subtree-mainline:f1be11fca8
git-subtree-split:fc21396bc8
23 lines
674 B
Zig
23 lines
674 B
Zig
const std = @import("std");
|
|
const intcode = @import("intcode");
|
|
|
|
pub fn main() anyerror!void {
|
|
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
|
defer arena.deinit();
|
|
|
|
const alloc = &arena.allocator;
|
|
|
|
var program = try intcode.loadFromStdIn(alloc);
|
|
|
|
var machine = try intcode.Machine.init(alloc, program);
|
|
try machine.writeToInput(1); // BOOST program in test mode
|
|
try machine.run();
|
|
|
|
std.debug.warn("Day 9, Part 1: {}\n", try machine.readFromOutput());
|
|
|
|
try machine.writeToInput(2); // BOOST program in sensor boost mode
|
|
try machine.run();
|
|
|
|
std.debug.warn("Day 9, Part 2: {}\n", try machine.readFromOutput());
|
|
}
|