sdf
This commit is contained in:
parent
f45821ca48
commit
80816f56f6
24
src/day5.zig
24
src/day5.zig
@ -31,6 +31,7 @@ pub fn main() !void
|
|||||||
if(try checkOrder(allocator,dat,&rules)) | failed_rule |
|
if(try checkOrder(allocator,dat,&rules)) | failed_rule |
|
||||||
{
|
{
|
||||||
print("dataset failed at rule {d}\n",.{failed_rule});
|
print("dataset failed at rule {d}\n",.{failed_rule});
|
||||||
|
//try to rearange those
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -177,3 +178,26 @@ fn getMiddleFromSlice(data : []u64) usize
|
|||||||
|
|
||||||
return middle;
|
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(
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user