Update template to latest master

This commit is contained in:
Krzysztof Wolicki 2023-11-29 08:06:07 +01:00
parent 0433fdb88b
commit b1584f91a2
32 changed files with 288 additions and 432 deletions

View file

@ -1,6 +1,6 @@
{
"recommendations": [
"augusterame.zls-vscode",
"ziglang.vscode-zig",
"ms-vscode.cpptools"
]
}

50
.vscode/tasks.json vendored
View file

@ -7,7 +7,7 @@
"label": "build day 01",
"type": "shell",
"command": "zig",
"args": ["build", "install_day01"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day01"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -15,7 +15,7 @@
"label": "build day 02",
"type": "shell",
"command": "zig",
"args": ["build", "install_day02"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day02"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -23,7 +23,7 @@
"label": "build day 03",
"type": "shell",
"command": "zig",
"args": ["build", "install_day03"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day03"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -31,7 +31,7 @@
"label": "build day 04",
"type": "shell",
"command": "zig",
"args": ["build", "install_day04"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day04"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -39,7 +39,7 @@
"label": "build day 05",
"type": "shell",
"command": "zig",
"args": ["build", "install_day05"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day05"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -47,7 +47,7 @@
"label": "build day 06",
"type": "shell",
"command": "zig",
"args": ["build", "install_day06"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day06"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -55,7 +55,7 @@
"label": "build day 07",
"type": "shell",
"command": "zig",
"args": ["build", "install_day07"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day07"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -63,7 +63,7 @@
"label": "build day 08",
"type": "shell",
"command": "zig",
"args": ["build", "install_day08"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day08"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -71,7 +71,7 @@
"label": "build day 09",
"type": "shell",
"command": "zig",
"args": ["build", "install_day09"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day09"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -79,7 +79,7 @@
"label": "build day 10",
"type": "shell",
"command": "zig",
"args": ["build", "install_day10"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day10"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -87,7 +87,7 @@
"label": "build day 11",
"type": "shell",
"command": "zig",
"args": ["build", "install_day11"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day11"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -95,7 +95,7 @@
"label": "build day 12",
"type": "shell",
"command": "zig",
"args": ["build", "install_day12"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day12"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -103,7 +103,7 @@
"label": "build day 13",
"type": "shell",
"command": "zig",
"args": ["build", "install_day13"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day13"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -111,7 +111,7 @@
"label": "build day 14",
"type": "shell",
"command": "zig",
"args": ["build", "install_day14"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day14"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -119,7 +119,7 @@
"label": "build day 15",
"type": "shell",
"command": "zig",
"args": ["build", "install_day15"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day15"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -127,7 +127,7 @@
"label": "build day 16",
"type": "shell",
"command": "zig",
"args": ["build", "install_day16"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day16"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -135,7 +135,7 @@
"label": "build day 17",
"type": "shell",
"command": "zig",
"args": ["build", "install_day17"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day17"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -143,7 +143,7 @@
"label": "build day 18",
"type": "shell",
"command": "zig",
"args": ["build", "install_day18"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day18"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -151,7 +151,7 @@
"label": "build day 19",
"type": "shell",
"command": "zig",
"args": ["build", "install_day19"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day19"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -159,7 +159,7 @@
"label": "build day 20",
"type": "shell",
"command": "zig",
"args": ["build", "install_day20"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day20"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -167,7 +167,7 @@
"label": "build day 21",
"type": "shell",
"command": "zig",
"args": ["build", "install_day21"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day21"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -175,7 +175,7 @@
"label": "build day 22",
"type": "shell",
"command": "zig",
"args": ["build", "install_day22"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day22"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -183,7 +183,7 @@
"label": "build day 23",
"type": "shell",
"command": "zig",
"args": ["build", "install_day23"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day23"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -191,7 +191,7 @@
"label": "build day 24",
"type": "shell",
"command": "zig",
"args": ["build", "install_day24"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day24"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},
@ -199,7 +199,7 @@
"label": "build day 25",
"type": "shell",
"command": "zig",
"args": ["build", "install_day25"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
"args": ["build", "install_day25"], // add -Doptimize=ReleaseSafe or -Doptimize=ReleaseFast to optimize
"problemMatcher": [],
"group": "build",
},

137
build.zig
View file

@ -1,61 +1,35 @@
const std = @import("std");
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
const required_zig_version = std.SemanticVersion.parse("0.10.0") catch unreachable;
const padded_int_fix = std.SemanticVersion.parse("0.11.0-dev.331+304e82808") catch unreachable;
const Build = std.Build;
const CompileStep = std.Build.Step.Compile;
/// set this to true to link libc
const should_link_libc = false;
fn linkObject(b: *Builder, obj: *LibExeObjStep) void {
fn linkObject(b: *Build, obj: *CompileStep) void {
if (should_link_libc) obj.linkLibC();
_ = b;
// Padded integers are buggy in 0.10.0, fixed in 0.11.0-dev.331+304e82808
// This is especially bad for AoC because std.StaticBitSet is commonly used.
// If your version is older than that, we use stage1 to avoid this bug.
// Issue: https://github.com/ziglang/zig/issues/13480
// Fix: https://github.com/ziglang/zig/pull/13637
if (comptime @import("builtin").zig_version.order(padded_int_fix) == .lt) {
obj.use_stage1 = true;
}
// Add linking for packages or third party libraries here
}
pub fn build(b: *Builder) void {
if (comptime @import("builtin").zig_version.order(required_zig_version) == .lt) {
std.debug.print(
\\Error: Your version of Zig is missing features that are needed for this template.
\\You will need to download a newer build.
\\
\\ https://ziglang.org/download/
\\
\\
, .{});
std.os.exit(1);
}
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
pub fn build(b: *Build) void {
const target = b.standardTargetOptions(.{});
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
const mode = b.standardOptimizeOption(.{});
const install_all = b.step("install_all", "Install all days");
const install_all_tests = b.step("install_tests_all", "Install tests for all days");
_ = install_all_tests;
const run_all = b.step("run_all", "Run all days");
const generate = b.step("generate", "Generate stub files from template/template.zig");
const build_generate = b.addExecutable("generate", "template/generate.zig");
build_generate.setBuildMode(.ReleaseSafe);
const run_generate = build_generate.run();
run_generate.cwd = std.fs.path.dirname(@src().file).?;
const build_generate = b.addExecutable(.{
.name = "generate",
.root_source_file = .{ .path = "template/generate.zig" },
.optimize = .ReleaseSafe,
});
const run_generate = b.addRunArtifact(build_generate);
run_generate.setCwd(.{ .path = std.fs.path.dirname(@src().file).? });
generate.dependOn(&run_generate.step);
// Set up an exe for each day
@ -64,24 +38,24 @@ pub fn build(b: *Builder) void {
const dayString = b.fmt("day{:0>2}", .{day});
const zigFile = b.fmt("src/{s}.zig", .{dayString});
const exe = b.addExecutable(dayString, zigFile);
exe.setTarget(target);
exe.setBuildMode(mode);
linkObject(b, exe);
exe.install();
const install_cmd = b.addInstallArtifact(exe);
const run_test = b.addTest(zigFile);
run_test.setTarget(target);
run_test.setBuildMode(mode);
const exe = b.addExecutable(.{
.name = dayString,
.root_source_file = .{ .path = zigFile },
.target = target,
.optimize = mode,
});
linkObject(b, exe);
const build_test = b.addTestExe(b.fmt("test_{s}", .{dayString}), zigFile);
build_test.setTarget(target);
build_test.setBuildMode(mode);
linkObject(b, exe);
const install_test = b.addInstallArtifact(build_test);
const install_cmd = b.addInstallArtifact(exe, .{});
const build_test = b.addTest(.{
.root_source_file = .{ .path = zigFile },
.target = target,
.optimize = mode,
});
linkObject(b, build_test);
const run_test = b.addRunArtifact(build_test);
{
const step_key = b.fmt("install_{s}", .{dayString});
@ -98,16 +72,7 @@ pub fn build(b: *Builder) void {
step.dependOn(&run_test.step);
}
{
const step_key = b.fmt("install_tests_{s}", .{dayString});
const step_desc = b.fmt("Install test_{s}.exe", .{dayString});
const step = b.step(step_key, step_desc);
step.dependOn(&install_test.step);
install_all_tests.dependOn(&install_test.step);
}
const run_cmd = exe.run();
run_cmd.step.dependOn(&install_cmd.step);
const run_cmd = b.addRunArtifact(exe);
if (b.args) |args| {
run_cmd.addArgs(args);
}
@ -121,42 +86,12 @@ pub fn build(b: *Builder) void {
// Set up tests for util.zig
{
const test_util = b.step("test_util", "Run tests in util.zig");
const test_cmd = b.addTest("src/util.zig");
test_cmd.setTarget(target);
test_cmd.setBuildMode(mode);
const test_cmd = b.addTest(.{
.root_source_file = .{ .path = "src/util.zig" },
.target = target,
.optimize = mode,
});
linkObject(b, test_cmd);
test_util.dependOn(&test_cmd.step);
}
// Set up test executable for util.zig
{
const test_util = b.step("install_tests_util", "Run tests in util.zig");
const test_exe = b.addTestExe("test_util", "src/util.zig");
test_exe.setTarget(target);
test_exe.setBuildMode(mode);
linkObject(b, test_exe);
const install = b.addInstallArtifact(test_exe);
test_util.dependOn(&install.step);
}
// Set up a step to run all tests
{
const test_step = b.step("test", "Run all tests");
const test_cmd = b.addTest("src/test_all.zig");
test_cmd.setTarget(target);
test_cmd.setBuildMode(mode);
linkObject(b, test_cmd);
test_step.dependOn(&test_cmd.step);
}
// Set up a step to build tests (but not run them)
{
const test_build = b.step("install_tests", "Install test_all.exe");
const test_exe = b.addTestExe("test_all", "src/test_all.zig");
test_exe.setTarget(target);
test_exe.setBuildMode(mode);
linkObject(b, test_exe);
const test_exe_install = b.addInstallArtifact(test_exe);
test_build.dependOn(&test_exe_install.step);
}
}

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day01.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day02.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day03.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day04.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day05.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day06.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day07.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day08.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day09.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day10.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day11.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day12.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day13.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day14.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day15.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day16.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day17.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day18.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day19.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day20.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day21.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day22.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day23.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day24.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day25.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -11,10 +11,13 @@ pub const gpa = gpa_impl.allocator();
// Add utility functions here
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -28,14 +31,9 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;

View file

@ -15,7 +15,7 @@ fn instantiateTemplate(template: []const u8, day: u32) ![]const u8 {
while (std.mem.indexOfScalar(u8, rest, '$')) |index| {
try list.appendSlice(rest[0..index]);
try std.fmt.format(list.writer(), "{d:0>2}", .{day});
rest = rest[index+1..];
rest = rest[index + 1 ..];
}
try list.appendSlice(rest);
return list.toOwnedSlice();
@ -31,7 +31,7 @@ fn readHashes() !*[25][Hash.digest_length]u8 {
if (hash_bytes.len != 25 * Hash.digest_length)
return error.InvalidFormat;
return @ptrCast(*[25][Hash.digest_length]u8, hash_bytes.ptr);
return @ptrCast(hash_bytes.ptr);
}
pub fn main() !void {
@ -41,7 +41,7 @@ pub fn main() !void {
error.FileNotFound => blk: {
std.debug.print("{s} doesn't exist, will assume all files have been modified.\nDelete src/dayXX.zig and rerun `zig build generate` to regenerate it.\n", .{hashes_file});
const mem = try gpa.allocator().create([25][Hash.digest_length]u8);
@memset(@ptrCast([*]u8, mem), 0, @sizeOf(@TypeOf(mem.*)));
@memset(std.mem.sliceAsBytes(mem), 0);
break :blk mem;
},
error.InvalidFormat => {
@ -49,7 +49,7 @@ pub fn main() !void {
std.os.exit(1);
},
else => |e| {
std.debug.print("Failed to open {s}: {}\n", .{hashes_file, e});
std.debug.print("Failed to open {s}: {}\n", .{ hashes_file, e });
return e;
},
};
@ -62,7 +62,7 @@ pub fn main() !void {
defer gpa.allocator().free(filename);
var new_file = false;
const file = std.fs.cwd().openFile(filename, .{.mode = .read_write}) catch |err| switch (err) {
const file = std.fs.cwd().openFile(filename, .{ .mode = .read_write }) catch |err| switch (err) {
error.FileNotFound => blk: {
new_file = true;
break :blk try std.fs.cwd().createFile(filename, .{});
@ -86,7 +86,7 @@ pub fn main() !void {
var hash: [Hash.digest_length]u8 = undefined;
Hash.hash(contents, &hash, .{});
regenerate = std.mem.eql(u8, &hash, &hashes[day-1]);
regenerate = std.mem.eql(u8, &hash, &hashes[day - 1]);
} else {
regenerate = true;
}
@ -100,7 +100,7 @@ pub fn main() !void {
const text = try instantiateTemplate(template, day);
defer gpa.allocator().free(text);
Hash.hash(text, &hashes[day-1], .{});
Hash.hash(text, &hashes[day - 1], .{});
updated_hashes = true;
try file.writeAll(text);
@ -118,9 +118,9 @@ pub fn main() !void {
if (updated_hashes) {
try std.fs.cwd().writeFile(hashes_file, std.mem.asBytes(hashes));
if (skipped_any) {
std.debug.print("Some days were skipped. Delete them to force regeneration.\n",.{});
std.debug.print("Some days were skipped. Delete them to force regeneration.\n", .{});
}
} else {
std.debug.print("No updates made, all days were modified. Delete src/dayXX.zig to force regeneration.\n", .{});
}
}
}

View file

@ -1 +1,2 @@
*®3tï° ô™Q[ûå/ÖX°ÿÕå1¯äcT­—7È£Cžd`´¬'µsÓR&=ÈR/º^Ä<>|€h—Jà—Ü{-†d{¼Œ|ㆾîþï4™ú„ƒª^¿üdz·C²Êõ)¸Ù”³=‘ÒÏì¬,…¥ƒ§Iã<49>œO|„Á\SŸïŧê!V£7äï3ÃZ¢# @GX°ö”ÈØ<C388>T¬#Ìhb3Œâ¢Yì*aí±ðû1—»¾ExåýáÑ)×Seì<65>î-é>;„ÉõqhvÈCL·üµ;«õ¸5â+X©I_àfð,\…ÑîL>oûõl€×vÇnCÈ7jöÝ V¯Ð4ŽRÍ7Lì<C3AC>·iCqóÙ [ž ë¤&\ˆlùÀ»«=ÌÇÇ“œë>&4ÔRE RhX;"Ì3Çk}=Ó±žQÈú”OrZFÚì ­g ¹VâÑ•yÀ¸.åî!õæ>ø?†òÇ·hÕ=:: –”Ä
Ř»ËÍoűö(“Ŕ<E2809C>aSôÚŞx0QoÔɉjU!@Ĺh@GU•/Ř ,–Ő Ź Sźs<C5BA><73>N´<4E>(a JqŃĹB<C4B9>}Ăö÷˘fŠäGQĄÜ[Üç¶ó&Ě•« ě ôf a×M<10>‡=ęĐ2ć]vś źú|­ >™ÚDŚ>=Wq[ż¤Ď´P’ÉZvorrRur[J|ŇW¸)Âc^ŹbŘđ!ë±Z]ĄŁsж߾!˛n'°Q {÷&JqóbA…˛ŕČŇ `ąHü<48>pňIĂúŕ<C3BA>©«ÎkëX`+LÎŇuBź}„š¤7Ũ»ęµő521éJáŘ
¨  KłîߤŽJ]Ě%<25>YXat”šCˇĆŢć3AK¬†ŤšzüňTşŔ5G©H]©ŚLËćţň­ó<ę}×(Ü`Ë̇&oŽ<đ±Aţ]6î:˘a‡E†ní|Eş`°Ó™LÜ•,‡ÇŞřďd%î¸'',pÇ:ń

View file

@ -10,13 +10,15 @@ const gpa = util.gpa;
const data = @embedFile("data/day$.txt");
pub fn main() !void {
}
pub fn main() !void {}
// Useful stdlib functions
const tokenize = std.mem.tokenize;
const split = std.mem.split;
const tokenizeAny = std.mem.tokenizeAny;
const tokenizeSeq = std.mem.tokenizeSequence;
const tokenizeSca = std.mem.tokenizeScalar;
const splitAny = std.mem.splitAny;
const splitSeq = std.mem.splitSequence;
const splitSca = std.mem.splitScalar;
const indexOf = std.mem.indexOfScalar;
const indexOfAny = std.mem.indexOfAny;
const indexOfStr = std.mem.indexOfPosLinear;
@ -30,15 +32,10 @@ const sliceMax = std.mem.max;
const parseInt = std.fmt.parseInt;
const parseFloat = std.fmt.parseFloat;
const min = std.math.min;
const min3 = std.math.min3;
const max = std.math.max;
const max3 = std.math.max3;
const print = std.debug.print;
const assert = std.debug.assert;
const sort = std.sort.sort;
const sort = std.sort.block;
const asc = std.sort.asc;
const desc = std.sort.desc;