mirror of
https://codeberg.org/andyscott/advent-of-code.git
synced 2024-12-22 01:23:11 -05:00
Compare commits
3 commits
f75fb88668
...
7dc3712207
Author | SHA1 | Date | |
---|---|---|---|
7dc3712207 | |||
a27a6df8b4 | |||
cfdad32c84 |
4 changed files with 274 additions and 14 deletions
140
2024/data/day4.txt
Normal file
140
2024/data/day4.txt
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
MMSMXMSASXMXAXMAXSASXXXMASAMXSMMMXMMXMXMASMXMASMSMXSSXMASXSMMSASMSAXAMXMAMMMSAMXXXMAMSMXMMMXMASXMAXXMMMXMMSAMXAMMSMSSMSMMMSMMXSXXAXMXSAXMASX
|
||||||
|
XAXMASMXMASASXSXAMAMXMXMAXAMXSASAMXMAMAMSAMSSXMMAXASXAMAMSMAXMXMASMSASASASAAMAMXSMSMSAXAAXXAMSSMXMXSMAMXXAXAXXASXAMAAXAAXXMAXAXXMMSSMSSXSASA
|
||||||
|
XMASXXXASAMAMASMMMAMMSASXSXMASAMMAXSAXXXMASXMASMSMMMMXMAXAXXMSAMXMAAXSASASMXSAMAAAAXSASMMMMMSAXMASAMSAMSMMSAMSAMAMMXSMSXMASXMASAASAAXMAMMAMM
|
||||||
|
SSMSMSSXMMMAMSMAXMAXXMAMMAMSXMSMMMXMAMSXSSMXSAMXXAASXMSMSMSMMSXSAMMMMMAMXMXAMASXMSMMMXMAAAXMMMSMAMAMMMMAAXMAMSAMXXXMAMAASXMAAXXMXMSMMMSMMAMX
|
||||||
|
XXAXAAAMMSSMMXASXSMSSMAMSAMXAXXXASMMSMSASAMXMASMSXMXAAXXAAAAASASAMAXSMSMSSMSSMAAXAXAMXMMMSXXAXAMSSSMMSSMSMSAMSMMSMXMMXSMSASXSXMMSMAMAAMAMASX
|
||||||
|
MMMMSMMAAAAMASXMAAXAAMSMXAMSAMXSMXAAAAMMMAMASMMMASXSMMSSSSSSMMMMMSAMSXASAAAAAMMXSXSMXSSXSAXAMMMSMAXAAXAMXAASAMXMXAMX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MSSSMXMAMSMMMSSMAMAAMXSASASASMSSXSXAASMSMSSMMMMMXXASXMSSMMSSSMMXXAASXSAMXXXAXXXAAXAMMSMSAAMXMMXAASMSMMAAMXSAXMASXMA
|
||||||
|
MAMSSXMAMXXAMAXMMSSMAMXXXAXMAMAMXAXAAAAAXAMMXXXMAMAMAXAMMAMASXMAAXAXSXXXAXMAXSAAXXAXAAASMMSXSASXSSXSMSMSMMXAMXAAXXMXAMXSSMMMAAMMMSXMMXSSMASX
|
||||||
|
XMSAAMSMSSSSMSMSAAAXXSMMMSMXAMMSMAMSMMSSSMSMSAMXSMSMSMASMMMAMMMSMMMSXSMMSSMMMMMMSMMMMSMMAAXAMAMAMAASAAXMAXSASXXSMAMSMMAAAASXSSMMMSAXAASASAMM
|
||||||
|
SXMMSMAAAAAMAAAMMSMMSXAAAAASMSAXMAMAAMAAAAAASMAAXAXAXSAMAAMASXXMASXSAMXAAAAAXXSAMXSAMXXMMMMAMAMAMMSMSMMSAMSAMAXXMXMASMXSSMMMXAAAASMMMSSMMMSA
|
||||||
|
XXXXXXMSMMMMMMSMXAXMASXMSXMAAMMSSMSSSMXSMMMMMMSAMSMMMMMSSMSXSASXMMSMAMMMSSMMAMXXMASXSAXMAMSXSXSXSXXMAMXMXXMMMAMXAXMAMSAAXMXMASXMMSXXMAMXXMAX
|
|
@ -105,12 +105,12 @@ pub fn main() !void {
|
||||||
window.reset();
|
window.reset();
|
||||||
const p2 = try maybeScan(u8, &window);
|
const p2 = try maybeScan(u8, &window);
|
||||||
|
|
||||||
log.info("PART 1: {d}\n", .{p1});
|
log.info("PART 1: {d}", .{p1});
|
||||||
log.info("PART 2: {d}\n", .{p2});
|
log.info("PART 2: {d}", .{p2});
|
||||||
}
|
}
|
||||||
|
|
||||||
test "memory" {
|
test "memory" {
|
||||||
const input = try util.readAllInput(3, std.testing.allocator);
|
const input = try util.readAllInput(3, util.test_alloc);
|
||||||
defer std.testing.allocator.free(input);
|
defer std.testing.allocator.free(input);
|
||||||
|
|
||||||
var mul = MulOp.init();
|
var mul = MulOp.init();
|
||||||
|
|
122
2024/src/day4.zig
Normal file
122
2024/src/day4.zig
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
const util = @import("util.zig");
|
||||||
|
const log = util.log;
|
||||||
|
|
||||||
|
const Directions = enum { e, w, n, s, ne, nw, se, sw, done };
|
||||||
|
|
||||||
|
fn toMatrix(allocator: std.mem.Allocator) !std.ArrayList([]const u8) {
|
||||||
|
const input = try util.readAllInput(4, allocator);
|
||||||
|
errdefer allocator.free(input);
|
||||||
|
|
||||||
|
const mat: std.ArrayList([]const u8) = try util.inputTo2x2(u8, allocator, input, '\n');
|
||||||
|
errdefer mat.deinit();
|
||||||
|
|
||||||
|
return mat;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn isValidPoint(x: i16, y: i16, max: [2]u8) bool {
|
||||||
|
return 0 <= x and x <= max[0] and 0 <= y and y <= max[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
fn isXmas(matrix: [][]const u8, start: [2]u8, max: [2]u8, delta: [2]i8) !bool {
|
||||||
|
for (1..4) |i| {
|
||||||
|
const step: i8 = @intCast(i);
|
||||||
|
const x = try std.math.add(i16, @intCast(start[0]), delta[0] * step);
|
||||||
|
const y = try std.math.add(i16, @intCast(start[1]), delta[1] * step);
|
||||||
|
|
||||||
|
if (!isValidPoint(x, y, max)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ux: u8 = @intCast(x);
|
||||||
|
const uy: u8 = @intCast(y);
|
||||||
|
if ((i == 1 and matrix[ux][uy] != 'M') or
|
||||||
|
(i == 2 and matrix[ux][uy] != 'A') or
|
||||||
|
(i == 3 and matrix[ux][uy] != 'S'))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part1(matrix: [][]const u8, start: [2]u8, max: [2]u8) !u8 {
|
||||||
|
var result: u8 = 0;
|
||||||
|
var direction: Directions = .e;
|
||||||
|
|
||||||
|
var delta: [2]i8 = .{ 0, 0 };
|
||||||
|
while (direction != .done) {
|
||||||
|
const new_direction = @intFromEnum(direction) + 1;
|
||||||
|
defer direction = @enumFromInt(new_direction);
|
||||||
|
|
||||||
|
switch (direction) {
|
||||||
|
.e => delta = .{ 0, 1 },
|
||||||
|
.w => delta = .{ 0, -1 },
|
||||||
|
.n => delta = .{ -1, 0 },
|
||||||
|
.s => delta = .{ 1, 0 },
|
||||||
|
.ne => delta = .{ -1, 1 },
|
||||||
|
.nw => delta = .{ -1, -1 },
|
||||||
|
.se => delta = .{ 1, 1 },
|
||||||
|
.sw => delta = .{ 1, -1 },
|
||||||
|
else => unreachable,
|
||||||
|
}
|
||||||
|
if (try isXmas(matrix, start, max, delta))
|
||||||
|
result += 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(matrix: [][]const u8, start: [2]u8, max: [2]u8) !bool {
|
||||||
|
const nw_pt = .{ try std.math.add(i16, @intCast(start[0]), -1), try std.math.add(i16, @intCast(start[1]), -1) };
|
||||||
|
const ne_pt = .{ try std.math.add(i16, @intCast(start[0]), -1), try std.math.add(i16, @intCast(start[1]), 1) };
|
||||||
|
const sw_pt = .{ try std.math.add(i16, @intCast(start[0]), 1), try std.math.add(i16, @intCast(start[1]), -1) };
|
||||||
|
const se_pt = .{ try std.math.add(i16, @intCast(start[0]), 1), try std.math.add(i16, @intCast(start[1]), 1) };
|
||||||
|
|
||||||
|
if (!isValidPoint(nw_pt[0], nw_pt[1], max) or
|
||||||
|
!isValidPoint(ne_pt[0], ne_pt[1], max) or
|
||||||
|
!isValidPoint(sw_pt[0], sw_pt[1], max) or
|
||||||
|
!isValidPoint(se_pt[0], se_pt[1], max))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nw_ch = matrix[start[0] - 1][start[1] - 1];
|
||||||
|
const ne_ch = matrix[start[0] - 1][start[1] + 1];
|
||||||
|
const sw_ch = matrix[start[0] + 1][start[1] - 1];
|
||||||
|
const se_ch = matrix[start[0] + 1][start[1] + 1];
|
||||||
|
|
||||||
|
if (!(nw_ch == 'M' and ne_ch == 'M' and sw_ch == 'S' and se_ch == 'S') and
|
||||||
|
!(nw_ch == 'S' and ne_ch == 'S' and sw_ch == 'M' and se_ch == 'M') and
|
||||||
|
!(nw_ch == 'M' and ne_ch == 'S' and sw_ch == 'M' and se_ch == 'S') and
|
||||||
|
!(nw_ch == 'S' and ne_ch == 'M' and sw_ch == 'S' and se_ch == 'M'))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn main() !void {
|
||||||
|
const allocator = util.alloc;
|
||||||
|
const mat = try toMatrix(allocator);
|
||||||
|
defer mat.deinit();
|
||||||
|
|
||||||
|
const max: [2]u8 = .{ @intCast(mat.items[0].len - 1), @intCast(mat.items.len - 1) };
|
||||||
|
|
||||||
|
var p1: u16 = 0;
|
||||||
|
var p2: u16 = 0;
|
||||||
|
for (mat.items, 0..) |_, row| {
|
||||||
|
for (mat.items[row], 0..) |_, col| {
|
||||||
|
const start: [2]u8 = .{ @intCast(row), @intCast(col) };
|
||||||
|
if (mat.items[row][col] == 'X')
|
||||||
|
p1 += try part1(mat.items, start, max);
|
||||||
|
|
||||||
|
if (mat.items[row][col] == 'A')
|
||||||
|
p2 += if (try part2(mat.items, start, max)) 1 else 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("PART 1: {d}", .{p1});
|
||||||
|
log.info("PART 2: {d}", .{p2});
|
||||||
|
}
|
|
@ -5,24 +5,22 @@ const TokenIterator = std.mem.TokenIterator;
|
||||||
// Memory
|
// Memory
|
||||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||||
pub const alloc = gpa.allocator();
|
pub const alloc = gpa.allocator();
|
||||||
|
pub const test_alloc = std.testing.allocator;
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
pub const log = std.log.default;
|
pub const log = std.log.default;
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
pub fn tokenizeAllInput(allocator: Allocator, outputType: type, day: u8) !TokenIterator {
|
pub fn inputTo2x2(comptime T: type, allocator: Allocator, input: []const T, delimiter: T) !std.ArrayList([]const T) {
|
||||||
var fileName: [16]u8 = undefined;
|
var out = std.ArrayList([]const T).init(allocator);
|
||||||
const inputFile = try std.fmt.bufPrint(&fileName, "day{d}.txt", .{day});
|
errdefer out.deinit();
|
||||||
|
|
||||||
var dir = try std.fs.cwd().openDir("../data", .{});
|
var items = std.mem.tokenizeScalar(u8, input, delimiter);
|
||||||
defer dir.close();
|
while (items.next()) |item| {
|
||||||
|
try out.append(item);
|
||||||
|
}
|
||||||
|
|
||||||
const file = try dir.openFile(inputFile, .{});
|
return out;
|
||||||
defer file.close();
|
|
||||||
|
|
||||||
const stat = try file.stat();
|
|
||||||
const input = try file.reader().readAllAlloc(allocator, stat.size);
|
|
||||||
return inputToArrayList(outputType, allocator, input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn readAllInput(day: u8, allocator: std.mem.Allocator) ![]const u8 {
|
pub fn readAllInput(day: u8, allocator: std.mem.Allocator) ![]const u8 {
|
||||||
|
|
Loading…
Reference in a new issue