aboutsummaryrefslogtreecommitdiff
path: root/day3.zig
diff options
context:
space:
mode:
authorMartin Ashby <martin@ashbysoft.com>2023-12-04 20:53:21 +0000
committerMartin Ashby <martin@ashbysoft.com>2023-12-04 20:53:21 +0000
commit3521330407bac556ab075cae0dd5d27ddc313d6c (patch)
treed57d7ff40315ca49b58d390e97da6e0eaff77dda /day3.zig
parentb3b47eb8664a6f530fb33df6a1a5ffbe6c86cb32 (diff)
downloadaoc2023-3521330407bac556ab075cae0dd5d27ddc313d6c.tar.gz
aoc2023-3521330407bac556ab075cae0dd5d27ddc313d6c.tar.bz2
aoc2023-3521330407bac556ab075cae0dd5d27ddc313d6c.tar.xz
aoc2023-3521330407bac556ab075cae0dd5d27ddc313d6c.zip
Day4
Plus fixes var -> const for latest zig version
Diffstat (limited to 'day3.zig')
-rw-r--r--day3.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/day3.zig b/day3.zig
index 04c432f..9bea1ab 100644
--- a/day3.zig
+++ b/day3.zig
@@ -17,7 +17,7 @@ const Grid = struct {
span_ix: []usize, // grid mapping of index into spans list
fn init(a: std.mem.Allocator, input: []const u8) !Grid {
- var spix = try a.alloc(usize, input.len);
+ const spix = try a.alloc(usize, input.len);
@memset(spix, std.math.maxInt(usize));
errdefer a.free(spix);
@@ -173,10 +173,10 @@ fn solve_pt2(a: std.mem.Allocator, input: []const u8) !u32 {
}
var ki = spixes.keyIterator();
if (ki.next()) |first| {
- var m = allSpans.items[first.*];
+ const m = allSpans.items[first.*];
//std.log.warn("span val m{}", .{m});
if (ki.next()) |second| {
- var m2 = allSpans.items[second.*];
+ const m2 = allSpans.items[second.*];
//std.log.warn("span val m2{}", .{m2});
// _EXACTLY_ two gears!
if (ki.next() == null) {