From 80816f56f61f9fe82dc44cd208343557f45b24ae Mon Sep 17 00:00:00 2001 From: jonathan santis Date: Tue, 24 Dec 2024 15:06:10 +0100 Subject: [PATCH] sdf --- src/day5.zig | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/day5.zig b/src/day5.zig index 2f48de7..1b8fca7 100644 --- a/src/day5.zig +++ b/src/day5.zig @@ -31,6 +31,7 @@ pub fn main() !void if(try checkOrder(allocator,dat,&rules)) | failed_rule | { print("dataset failed at rule {d}\n",.{failed_rule}); + //try to rearange those } else { @@ -177,3 +178,26 @@ fn getMiddleFromSlice(data : []u64) usize return middle; } + +fn orderNums(allocator : std.mem.Allocator, data : *[]u64, rules : *std.ArrayList([]u8)) ! void +{ + + const rules_i = try parseRule(allocator,rule); + + for(data) | dat | + { + + const failed_rule_index = try checkOrder(allocator,dat,rules); + const failed_rule = rules[failed_rule_index]; + + failed_rule_i = parseRule(allocator,failed_rule); + + const tmp = failed_rule_i[1]; + + //find the number in dat + if(std.mem.indexOf(u64,dat,tmp)) | index | + { + for( + } + + }