diff --git a/2024/10/hoof_it/benchmarks/puzzle_benchmarks.zig b/2024/10/hoof_it/benchmarks/puzzle_benchmarks.zig new file mode 100644 index 00000000..e4e397e2 --- /dev/null +++ b/2024/10/hoof_it/benchmarks/puzzle_benchmarks.zig @@ -0,0 +1,27 @@ +const std = @import("std"); +const zbench = @import("zbench"); +const hoof_it = @import("hoof_it"); + +const puzzle_input = @embedFile("puzzle_input"); + +// Benchmark of part 1 +fn task_1(_: std.mem.Allocator) void { + _ = hoof_it.sum_of_trailhead_scores(puzzle_input) catch {}; +} + +// Benchmark of part 2 +fn task_2(_: std.mem.Allocator) void { + _ = hoof_it.sum_of_trailhead_ratings(puzzle_input) catch {}; +} + +pub fn main() !void { + const stdout = std.io.getStdOut().writer(); + var bench = zbench.Benchmark.init(std.heap.page_allocator, .{}); + defer bench.deinit(); + + try bench.add("Day 10 - Task 1", task_1, .{}); + try bench.add("Day 10 - Task 2", task_2, .{}); + + try stdout.writeAll("\n"); + try bench.run(stdout); +} diff --git a/2024/10/hoof_it/build.zig b/2024/10/hoof_it/build.zig new file mode 100644 index 00000000..b60c0f1b --- /dev/null +++ b/2024/10/hoof_it/build.zig @@ -0,0 +1,78 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + // -------------------------- Solution module --------------------------- \\ + const hoof_it = b.addModule("hoof_it", .{ + .root_source_file = b.path("src/hoof_it.zig"), + }); + + // -------------------------- Main executable --------------------------- \\ + const hoof_it_exe = b.addExecutable(.{ + .name = "hoof_it", + .root_source_file = b.path("src/main.zig"), + .target = target, + .optimize = optimize, + }); + + const yazap = b.dependency("yazap", .{}); + hoof_it_exe.root_module.addImport("yazap", yazap.module("yazap")); + hoof_it_exe.root_module.addImport("hoof_it", hoof_it); + b.installArtifact(hoof_it_exe); + + const run_cmd = b.addRunArtifact(hoof_it_exe); + run_cmd.step.dependOn(b.getInstallStep()); + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the hoof_it (day 10) app"); + run_step.dependOn(&run_cmd.step); + + // --------------------------- Example tests ---------------------------- \\ + const hoof_it_tests = b.addTest(.{ + .name = "hoof_it_tests", + .root_source_file = b.path("tests/example_tests.zig"), + .target = target, + .optimize = optimize, + }); + + hoof_it_tests.root_module.addImport("hoof_it", hoof_it); + inline for (1..8) |i| { + const num_str = std.fmt.comptimePrint("{!}", .{i}); + hoof_it_tests.root_module.addAnonymousImport( + "example_input_" ++ num_str, + .{ + .root_source_file = b.path("input/example_input_" ++ num_str ++ ".txt"), + }, + ); + } + b.installArtifact(hoof_it_tests); + + const test_step = b.step("test", "Run hoof_it (day 10) tests"); + test_step.dependOn(&b.addRunArtifact(hoof_it_tests).step); + + // ------------------------- Puzzle benchmarks -------------------------- \\ + const hoof_it_benchmarks = b.addExecutable(.{ + .name = "hoof_it_benchmarks", + .root_source_file = b.path("benchmarks/puzzle_benchmarks.zig"), + .target = target, + .optimize = optimize, + }); + + const zbench = b.dependency("zbench", .{ + .target = target, + .optimize = optimize, + }); + hoof_it_benchmarks.root_module.addImport("zbench", zbench.module("zbench")); + hoof_it_benchmarks.root_module.addImport("hoof_it", hoof_it); + hoof_it_benchmarks.root_module.addAnonymousImport("puzzle_input", .{ + .root_source_file = b.path("input/puzzle_input.txt"), + }); + b.installArtifact(hoof_it_benchmarks); + + const benchmark_step = b.step("benchmark", "Run hoof_it (day 10) benchmarks"); + benchmark_step.dependOn(&b.addRunArtifact(hoof_it_benchmarks).step); +} diff --git a/2024/10/hoof_it/build.zig.zon b/2024/10/hoof_it/build.zig.zon new file mode 100644 index 00000000..da1bc732 --- /dev/null +++ b/2024/10/hoof_it/build.zig.zon @@ -0,0 +1,23 @@ +.{ + .name = "hoof_it", + .version = "0.1.0", + .minimum_zig_version = "0.13.0", + .dependencies = .{ + .yazap = .{ + .url = "git+https://github.com/prajwalch/yazap#c2e3122d5dd6192513ba590f229dbc535110efb8", + .hash = "122054439ec36ac10987c87ae69f3b041b40b2e451af3fe3ef1fc578b3bad756a800", + }, + .zbench = .{ + .url = "git+https://github.com/hendriknielaender/zBench#fb3ecae5d035091fd2392a2ec21970c06fc375fa", + .hash = "122095b73930ff5d627429295c669905d85bb9b54394ddc185ad2d61295cc65819e5", + }, + }, + .paths = .{ + "build.zig", + "build.zig.zon", + "src", + "input", + "tests", + "benchmarks", + }, +} diff --git a/2024/10/hoof_it/input/example_input_1.txt b/2024/10/hoof_it/input/example_input_1.txt new file mode 100644 index 00000000..7bb1248f --- /dev/null +++ b/2024/10/hoof_it/input/example_input_1.txt @@ -0,0 +1,8 @@ +89010123 +78121874 +87430965 +96549874 +45678903 +32019012 +01329801 +10456732 \ No newline at end of file diff --git a/2024/10/hoof_it/input/example_input_2.txt b/2024/10/hoof_it/input/example_input_2.txt new file mode 100644 index 00000000..376ee8e9 --- /dev/null +++ b/2024/10/hoof_it/input/example_input_2.txt @@ -0,0 +1,7 @@ +...0... +...1... +...2... +6543456 +7.....7 +8.....8 +9.....9 \ No newline at end of file diff --git a/2024/10/hoof_it/input/example_input_3.txt b/2024/10/hoof_it/input/example_input_3.txt new file mode 100644 index 00000000..16c50764 --- /dev/null +++ b/2024/10/hoof_it/input/example_input_3.txt @@ -0,0 +1,7 @@ +..90..9 +...1.98 +...2..7 +6543456 +765.987 +876.... +987.... \ No newline at end of file diff --git a/2024/10/hoof_it/input/example_input_4.txt b/2024/10/hoof_it/input/example_input_4.txt new file mode 100644 index 00000000..2e42d654 --- /dev/null +++ b/2024/10/hoof_it/input/example_input_4.txt @@ -0,0 +1,7 @@ +10..9.. +2...8.. +3...7.. +4567654 +...8..3 +...9..2 +.....01 \ No newline at end of file diff --git a/2024/10/hoof_it/input/example_input_5.txt b/2024/10/hoof_it/input/example_input_5.txt new file mode 100644 index 00000000..98ab9315 --- /dev/null +++ b/2024/10/hoof_it/input/example_input_5.txt @@ -0,0 +1,7 @@ +.....0. +..4321. +..5..2. +..6543. +..7..4. +..8765. +..9.... \ No newline at end of file diff --git a/2024/10/hoof_it/input/example_input_6.txt b/2024/10/hoof_it/input/example_input_6.txt new file mode 100644 index 00000000..16c50764 --- /dev/null +++ b/2024/10/hoof_it/input/example_input_6.txt @@ -0,0 +1,7 @@ +..90..9 +...1.98 +...2..7 +6543456 +765.987 +876.... +987.... \ No newline at end of file diff --git a/2024/10/hoof_it/input/example_input_7.txt b/2024/10/hoof_it/input/example_input_7.txt new file mode 100644 index 00000000..b70d636d --- /dev/null +++ b/2024/10/hoof_it/input/example_input_7.txt @@ -0,0 +1,6 @@ +012345 +123456 +234567 +345678 +4.6789 +56789. \ No newline at end of file diff --git a/2024/10/hoof_it/input/puzzle_input.txt b/2024/10/hoof_it/input/puzzle_input.txt new file mode 100644 index 00000000..2abbb078 --- /dev/null +++ b/2024/10/hoof_it/input/puzzle_input.txt @@ -0,0 +1,60 @@ +432109865210212123765432101234321098543289654320132112121058 +045678774324301012892343023445456787650198763013241001034569 +187678789465692321001056014896234986456787012894653212123678 +296589921056789433217837895687145675323891233765784589238987 +345437835434576544786921278761010014210710321212098676521067 +032126546323465435695430789760121223121653450303145125430678 +123010567810156543212345699859834321056544067654236012321589 +543213498987657665401030787348765430187432198765987622345432 +654100332394348972342321895201256589196343089543212331056741 +789011241003238981089400776100343678015434567630105449879870 +296721256210169895676510385011892349101325678921256756768987 +129830787323456765410321294332761058210012310123890891057610 +056745698234556786329454301245656567341110567894781232346521 +145894510149645699438765892398305678956923498965654343765430 +236586789838732388454326765567214307967845697874505652894321 +105675676545321267565810674354303212875430786543216701678912 +234321501656130054278989983289432120123421803403545810787600 +321030432567032123123678100176563018987578912012932921298541 +892349803498145031034563210327898101879647810123871092567432 +785056712387236567687654389410787632768756303294562783458943 +176120987656547858998545076585894583459843214785103698327874 +015431234543218947657898145894983298708941025672234567016761 +329122345692105438941763236783470165617652912341013053205430 +478031001785676323430154100102565674320543805432332122124321 +567649872434985610121894321211056589211230796901440345034234 +456659763323810765456765894323987401108921687878981236565105 +306778654310329876365498765012342322317834510967892387156076 +219865011078478901278321001231451015436123423456785493087189 +652104102569560110669125198340760896895034587655476334196892 +765233243458721321701034567654878987764105694344301243234561 +894310321029832459852567878723965430653298743213210358765410 +132123478010741069743478989014436321541056543401821569898324 +098034569123658978654321876101521087632347812114981678876543 +107765678034567867569270965437698794545938903003470549987432 +256872345621098654378187602348967003897821094012561232789501 +345901436438767789210094511059854112766123285723034341076521 +217894387589656231234543223456743245675054176894125652112430 +306105498678543140567672100145101230984169065765898763203431 +495218321067012056478981041234230121243078434965235678976521 +584349452652100987329891230765345698732154567874143454989210 +673458763643211011010010049874556781235463456963056763474321 +567647601781012567892102156743765470346322161012369812565232 +498678432692123476543103095652834387457210052623871001450143 +304509543543001989698234589501921098768921106780982341019898 +213219601982132670787825676501432349810123235691987432870767 +894348732676544561236910787432321056769894344302346549961251 +765210145690125650345210097899867892110765654219854678450340 +890100126780034743094303126934786543023234565678765012321231 +765987034621129802185412235025696541032167876789874349876012 +876856541234988012276543384110567832249054965694101256778123 +965987650945876543543215493201378980158345434783450126789894 +457871056876067875456906780110234589267210321692569034670765 +320432347780128965307878767820199674307890160541078765521254 +011876548991234534218349856936788765216543254332112340432345 +432965432781049621029256743245215656325321067210003451201056 +547876501632898756540178652101304567101452198760116764342767 +656983432542765987438769789012453898212968765641985895433898 +898792323101874104329054210589562456703879454332076016924567 +125601017652963265012123323676571329894312303549165327810430 +034340178943012378901012334568980016765601212678234456901321 \ No newline at end of file diff --git a/2024/10/hoof_it/src/hoof_it.zig b/2024/10/hoof_it/src/hoof_it.zig new file mode 100644 index 00000000..05d994b5 --- /dev/null +++ b/2024/10/hoof_it/src/hoof_it.zig @@ -0,0 +1,289 @@ +const std = @import("std"); +const Allocator = std.mem.Allocator; +const ArrayList = std.ArrayList; +const HashMap = std.AutoArrayHashMap; +const string = []const u8; +const assert = std.debug.assert; + +/// Task 1 - Calculate the sum of all trailhead scores. A trailhead score is the +/// amount of summits (9) that are reachable from a trailhead (0) via +/// a constant increasing path (exactly 9 steps). +/// +/// Arguments: +/// - `contents`: Input file contents. +/// +/// Returns: +/// - Sum of trailhead scores. +pub fn sum_of_trailhead_scores(contents: string) !usize { + var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + defer arena.deinit(); + + const allocator = arena.allocator(); + const map = try parse_hiking_map(contents, allocator); + + const trailheads = try map.get_trailheads(allocator); + var trailhead_score: usize = 0; + for (trailheads.items) |head| { + map.reset_values(); + map.value_ptr(head).* = 1; + map.traverse_trails(); + + for (0..map.y_size) |y| { + for (0..map.x_size) |x| { + const pos = Position{ .x = x, .y = y }; + if (map.z_ptr(pos).* == 9) { + trailhead_score += @intFromBool(map.value_ptr(pos).* > 0); + } + } + } + } + + return trailhead_score; +} + +/// Task 1 - Calculate the sum of all trailhead rating. A trailhead rating is +/// the amount of trails to any summit (9) from a trailhead (0) via a +/// constant increasing path (exactly 9 steps). +/// +/// Arguments: +/// - `contents`: Input file contents. +/// +/// Returns: +/// - Sum of trailhead ratings. +pub fn sum_of_trailhead_ratings(contents: string) !usize { + var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + defer arena.deinit(); + + const allocator = arena.allocator(); + const map = try parse_hiking_map(contents, allocator); + + const trailheads = try map.get_trailheads(allocator); + map.reset_values(); + for (trailheads.items) |head| { + map.value_ptr(head).* = 1; + } + + map.traverse_trails(); + + var trailhead_rating: usize = 0; + for (0..map.y_size) |y| { + for (0..map.x_size) |x| { + const pos = Position{ .x = x, .y = y }; + if (map.z_ptr(pos).* == 9) { + trailhead_rating += map.value_ptr(pos).*; + } + } + } + + return trailhead_rating; +} + +// -------------------------------------------------------------------------- \\ + +/// A position on a 2D map. +const Position = struct { x: usize, y: usize }; + +/// Cardinal direction. +const Direction = enum(u2) { north, east, south, west }; + +/// 2D map with heights (z) and additional values for all positions. +const HikingMap = struct { + z: ArrayList(u8), + values: ArrayList(u32), + x_size: usize, + y_size: usize, + + /// Initialize hiking map. + /// + /// Arguments: + /// - `x_size`: The size of the map in x direction. + /// - `y_size`: The size of the map in y direction. + /// - `allocator`: An allocator for the heights and values. + /// + /// Returns: + /// - The 2D hiking map. + fn init(x_size: usize, y_size: usize, allocator: Allocator) !HikingMap { + var z = ArrayList(u8).init(allocator); + try z.resize(x_size * y_size); + + var values = ArrayList(u32).init(allocator); + try values.resize(x_size * y_size); + + return HikingMap{ + .z = z, + .values = values, + .x_size = x_size, + .y_size = y_size, + }; + } + + /// Reset the values of all tiles to 0. + /// + /// Arguments: + /// - `self`: The hiking map object. + fn reset_values(self: HikingMap) void { + @memset(self.values.allocatedSlice(), 0); + } + + /// Traverse the map starting at the trail heads. At each step move to + /// neighbouring tiles which are exactly one unit higher. The 'move' will + /// increment the neighbour tile values by the values of the current tiles. + /// + /// Arguments: + /// - `self`: The hiking map object. + fn traverse_trails(self: HikingMap) void { + for (0..9) |z| { + for (0..self.y_size) |y| { + for (0..self.x_size) |x| { + const pos = Position{ .x = x, .y = y }; + if (self.z_ptr(pos).* == z) { + for (self.get_ascending_neighbours(pos)) |optional_neighbour| { + if (optional_neighbour) |neigbour| { + self.value_ptr(neigbour).* += self.value_ptr(pos).*; + } + } + } + } + } + } + } + + /// Return a pointer to the height of a tile at a given position. + /// + /// Arguments: + /// - `self`: The hiking map object. + /// - `pos`: The position of the tile. + /// + /// Returns: + /// - Pointer to the tile's height (z). + fn z_ptr(self: HikingMap, pos: Position) *u8 { + assert(pos.x < self.x_size); + assert(pos.y < self.y_size); + + return &self.z.items[pos.y * self.x_size + pos.x]; + } + + /// Return a pointer to the value of a tile at a given position. + /// + /// Arguments: + /// - `self`: The hiking map object. + /// - `pos`: The position of the tile. + /// + /// Returns: + /// - Pointer to the tile's value. + fn value_ptr(self: HikingMap, pos: Position) *u32 { + assert(pos.x < self.x_size); + assert(pos.y < self.y_size); + + return &self.values.items[pos.y * self.x_size + pos.x]; + } + + /// Return all neighbours that have a height exactly one unit higher than + /// tile at a given position. + /// + /// Arguments: + /// - `self`: The hiking map object. + /// - `pos`: The position of the tile. + /// + /// Returns: + /// - Array with optional neighbouring positions. The neighbour positions + /// that don't have a height exactly one unit higher are `null`. + fn get_ascending_neighbours(self: HikingMap, pos: Position) [4]?Position { + var neighbours: [4]?Position = .{ null, null, null, null }; + for (0..4) |i| { + const dir: Direction = @enumFromInt(i); + const neighbour = self.move(dir, pos) catch { + continue; + }; + if (self.z_ptr(pos).* + 1 == self.z_ptr(neighbour).*) { + neighbours[i] = neighbour; + } + } + return neighbours; + } + + /// Make a move from a given position into a given direction. + /// + /// Arguments: + /// - `self`: The hiking map object. + /// - `dir`: The moving direction. + /// - `pos`: The position of the tile. + /// + /// Returns: + /// - The new position after the move. + /// - `error.OutOfBounds` if the move would leave the map. + fn move(self: HikingMap, dir: Direction, pos: Position) !Position { + return switch (dir) { + Direction.north => blk: { + if (pos.y == 0) { + return error.OutOfBounds; + } + break :blk Position{ .x = pos.x, .y = pos.y - 1 }; + }, + Direction.east => blk: { + if (pos.x >= self.x_size - 1) { + return error.OutOfBounds; + } + break :blk Position{ .x = pos.x + 1, .y = pos.y }; + }, + Direction.south => blk: { + if (pos.y >= self.y_size - 1) { + return error.OutOfBounds; + } + break :blk Position{ .x = pos.x, .y = pos.y + 1 }; + }, + Direction.west => blk: { + if (pos.x == 0) { + return error.OutOfBounds; + } + break :blk Position{ .x = pos.x - 1, .y = pos.y }; + }, + }; + } + + /// Return a list of all trailheads (height 0). + /// + /// Arguments: + /// - `self`: The hiking map object. + /// - `allocator`: Allocator for the array list. + /// + /// Returns: + /// - List of all trailheads. + /// - `error.OutOfMemory` if the allocation of the list fails. + fn get_trailheads(self: HikingMap, allocator: Allocator) !ArrayList(Position) { + var trailheads = ArrayList(Position).init(allocator); + for (0..self.y_size) |y| { + for (0..self.x_size) |x| { + if (self.z.items[y * self.x_size + x] == 0) { + try trailheads.append(Position{ .x = x, .y = y }); + } + } + } + return trailheads; + } +}; + +/// Parse the file contents into a 2D hiking map. +/// +/// Arguments: +/// - `contents`: Input file contents. +/// - `allocator`: Allocator for the containers. +/// +/// Returns: +/// - The 2D hiking map. +fn parse_hiking_map(contents: string, allocator: Allocator) !HikingMap { + var lines = std.mem.tokenize(u8, contents, "\r\n"); + const y_size: usize = @intCast(std.mem.count(u8, contents, &[1]u8{'\n'}) + 1); + const x_size: usize = lines.peek().?.len; + const map = try HikingMap.init(x_size, y_size, allocator); + + var tile_idx: usize = 0; + while (lines.next()) |line| { + for (line) |tile| { + map.z.items[tile_idx] = std.fmt.parseInt(u8, &[1]u8{tile}, 10) catch 100; + tile_idx += 1; + } + } + + return map; +} diff --git a/2024/10/hoof_it/src/main.zig b/2024/10/hoof_it/src/main.zig new file mode 100644 index 00000000..1568e823 --- /dev/null +++ b/2024/10/hoof_it/src/main.zig @@ -0,0 +1,56 @@ +const std = @import("std"); +const yazap = @import("yazap"); +const hoof_it = @import("hoof_it"); + +const allocator = std.heap.page_allocator; +const log = std.log; +const App = yazap.App; +const Arg = yazap.Arg; +const string = []const u8; + +pub fn main() !void { + var app = App.init(allocator, "Day 10", "Day 10: Hoof It"); + defer app.deinit(); + + var cmd = app.rootCommand(); + cmd.setProperty(.help_on_empty_args); + try cmd.addArg(Arg.singleValueOption( + "filename", + 'f', + "Input file (e.g. input/puzzle_input.txt)", + )); + + const matches = try app.parseProcess(); + + const stdout_file = std.io.getStdOut().writer(); + var bw = std.io.bufferedWriter(stdout_file); + const stdout = bw.writer(); + + var file_content: string = undefined; + if (matches.getSingleValue("filename")) |filename| { + const file = try std.fs.cwd().openFile(filename, .{}); + defer file.close(); + + const file_size = try file.getEndPos(); + const buffer: []u8 = try allocator.alloc(u8, file_size); + defer allocator.free(buffer); + + _ = try file.readAll(buffer); + file_content = std.mem.Allocator.dupe( + allocator, + u8, + std.mem.trim(u8, buffer, "\n"), + ) catch unreachable; + } else { + try app.displayHelp(); + return; + } + + const result_1 = hoof_it.sum_of_trailhead_scores(file_content); + try stdout.print("Sum of trailhead scores: {!}\n", .{result_1}); + try bw.flush(); + + const result_2 = hoof_it.sum_of_trailhead_ratings(file_content); + try stdout.print("Sum of trailhead ratings: {!}\n", .{result_2}); + try bw.flush(); +} diff --git a/2024/10/hoof_it/tests/example_tests.zig b/2024/10/hoof_it/tests/example_tests.zig new file mode 100644 index 00000000..b5887b4d --- /dev/null +++ b/2024/10/hoof_it/tests/example_tests.zig @@ -0,0 +1,69 @@ +const std = @import("std"); +const hoof_it = @import("hoof_it"); +const testing = std.testing; + +// Test of part 1 +test "task_1_input_1" { + const example_input = @embedFile("example_input_1"); + try testing.expectEqual( + 36, + hoof_it.sum_of_trailhead_scores(example_input), + ); +} + +test "task_1_input_2" { + const example_input = @embedFile("example_input_2"); + try testing.expectEqual( + 2, + hoof_it.sum_of_trailhead_scores(example_input), + ); +} + +test "task_1_input_3" { + const example_input = @embedFile("example_input_3"); + try testing.expectEqual( + 4, + hoof_it.sum_of_trailhead_scores(example_input), + ); +} + +test "task_1_input_4" { + const example_input = @embedFile("example_input_4"); + try testing.expectEqual( + 3, + hoof_it.sum_of_trailhead_scores(example_input), + ); +} + +// Test of part 2 +test "task_2_input_1" { + const example_input = @embedFile("example_input_1"); + try testing.expectEqual( + 81, + hoof_it.sum_of_trailhead_ratings(example_input), + ); +} + +test "task_2_input_5" { + const example_input = @embedFile("example_input_5"); + try testing.expectEqual( + 3, + hoof_it.sum_of_trailhead_ratings(example_input), + ); +} + +test "task_2_input_6" { + const example_input = @embedFile("example_input_6"); + try testing.expectEqual( + 13, + hoof_it.sum_of_trailhead_ratings(example_input), + ); +} + +test "task_2_input_7" { + const example_input = @embedFile("example_input_7"); + try testing.expectEqual( + 227, + hoof_it.sum_of_trailhead_ratings(example_input), + ); +} diff --git a/2024/build.zig b/2024/build.zig index 5f8799f6..ec227e27 100644 --- a/2024/build.zig +++ b/2024/build.zig @@ -37,4 +37,5 @@ pub fn build(b: *std.Build) void { add_subproject(b, target, optimize, test_step, benchmark_step, "03", "mull_it_over"); add_subproject(b, target, optimize, test_step, benchmark_step, "06", "guard_gallivant"); add_subproject(b, target, optimize, test_step, benchmark_step, "09", "disk_fragmenter"); + add_subproject(b, target, optimize, test_step, benchmark_step, "10", "hoof_it"); } diff --git a/2024/build.zig.zon b/2024/build.zig.zon index af4852ad..9f607d9b 100644 --- a/2024/build.zig.zon +++ b/2024/build.zig.zon @@ -9,6 +9,7 @@ .day_03_mull_it_over = .{ .path = "03/mull_it_over" }, .day_06_guard_gallivant = .{ .path = "06/guard_gallivant" }, .day_09_disk_fragmenter = .{ .path = "09/disk_fragmenter" }, + .day_10_hoof_it = .{ .path = "10/hoof_it" }, }, .paths = .{ "build.zig", @@ -19,5 +20,6 @@ "03", "06", "09", + "10", }, }