Add '2019/' from commit 'fc21396bc86bc0f706225f4f6e1d8294d344ca53'
git-subtree-dir: 2019 git-subtree-mainline:f1be11fca8
git-subtree-split:fc21396bc8
This commit is contained in:
22
2019/09/src/main.zig
Normal file
22
2019/09/src/main.zig
Normal file
@@ -0,0 +1,22 @@
|
||||
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());
|
||||
}
|
Reference in New Issue
Block a user